Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"stat": {
"display_name": "GP",
"name": "Games Played",
"sort_order": "1",
"stat_id": 0
}
},
...
},
"type": "full",
"url": "https://football.fantasysports.yahoo.com/f1"
}
"""
return self.query(
"https://fantasysports.yahooapis.com/fantasy/v2/game/" + self.game_code +
";out=metadata,players,game_weeks,stat_categories,position_types,roster_positions", ["game"], Game)
Example:
{
"code": "nfl",
"game_id": "331",
"game_key": "331",
"is_game_over": 1,
"is_offseason": 1,
"is_registration_over": 1,
"name": "Football",
"season": "2014",
"type": "full",
"url": "https://football.fantasysports.yahoo.com/archive/nfl/2014"
}
"""
return self.query(
"https://fantasysports.yahooapis.com/fantasy/v2/game/" + str(game_id) + "/metadata", ["game"], Game)
self.league_id = league_id
self.game_id = game_id
self.config = config
self.data_dir = data_dir
self.save_data = save_data
self.dev_offline = dev_offline
self.yahoo_data = Data(self.data_dir, save_data=save_data, dev_offline=dev_offline)
yahoo_auth_dir = os.path.join(base_dir, config.get("Yahoo", "yahoo_auth_dir"))
self.yahoo_query = YahooFantasySportsQuery(yahoo_auth_dir, self.league_id, self.game_id, offline=dev_offline)
if self.game_id and self.game_id != "nfl":
yahoo_fantasy_game = self.yahoo_data.retrieve(str(self.game_id) + "-game-metadata",
self.yahoo_query.get_game_metadata_by_game_id,
params={"game_id": self.game_id},
data_type_class=Game)
else:
yahoo_fantasy_game = self.yahoo_data.retrieve("current-game-metadata",
self.yahoo_query.get_current_game_metadata,
data_type_class=Game)
self.league_key = yahoo_fantasy_game.game_key + ".l." + self.league_id
self.season = yahoo_fantasy_game.season
# YAHOO API QUERY: run query to retrieve all league information, including current standings
self.league_info = self.yahoo_data.retrieve(str(self.league_id) + "-league-info",
self.yahoo_query.get_league_info,
data_type_class=League,
new_data_dir=os.path.join(self.data_dir,
str(self.season),
str(self.league_id))) # type: League