How to use the yfpy.models.Player function in yfpy

To help you get started, we’ve selected a few yfpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uberfastman / fantasy-football-metrics-weekly-report / dao / yahoo.py View on Github external
return self.yahoo_data.retrieve(
                player_key,
                self.yahoo_query.get_player_stats_by_week,
                params=params,
                new_data_dir=os.path.join(
                    self.data_dir, str(self.season), self.league_id, "week_" + str(week), "players"),
                data_type_class=Player
            )
        else:
            return self.yahoo_data.retrieve(
                player_key,
                self.yahoo_query.get_player_stats_for_season,
                params=params,
                new_data_dir=os.path.join(self.data_dir, str(self.season), self.league_id, "players"),
                data_type_class=Player
            )
github uberfastman / yfpy / yfpy / query.py View on Github external
"stat": {
                          "stat_id": "4",
                          "value": "4381"
                        }
                      },
                      ...
                    ]
                  },
                  "position_type": "O",
                  "primary_position": "QB",
                  "uniform_number": "12"
                }
        """
        return self.query(
            "https://fantasysports.yahooapis.com/fantasy/v2/league/" + self.get_league_key() + "/players;player_keys=" +
            str(player_key) + "/stats", ["league", "players", "0", "player"], Player)
github uberfastman / yfpy / yfpy / query.py View on Github external
{
                        "stat": {
                          "stat_id": "27",
                          "value": "0"
                        }
                      }
                    ]
                  },
                  "position_type": "G",
                  "primary_position": "G",
                  "uniform_number": "70"
                }
        """
        return self.query(
            "https://fantasysports.yahooapis.com/fantasy/v2/league/" + self.get_league_key() + "/players;player_keys=" +
            str(player_key) + "/stats;type=date;date=" + str(chosen_date), ["league", "players", "0", "player"], Player)
github uberfastman / fantasy-football-metrics-weekly-report / dao / yahoo.py View on Github external
def get_player_data(self, player_key, week=None):
        # YAHOO API QUERY: run query to retrieve stats for specific player for chosen week if supplied, else for season
        params = {"player_key": player_key}
        if week:
            params["chosen_week"] = week

            return self.yahoo_data.retrieve(
                player_key,
                self.yahoo_query.get_player_stats_by_week,
                params=params,
                new_data_dir=os.path.join(
                    self.data_dir, str(self.season), self.league_id, "week_" + str(week), "players"),
                data_type_class=Player
            )
        else:
            return self.yahoo_data.retrieve(
                player_key,
                self.yahoo_query.get_player_stats_for_season,
                params=params,
                new_data_dir=os.path.join(self.data_dir, str(self.season), self.league_id, "players"),
                data_type_class=Player
            )