Open Phloot opened 3 years ago
Hmm, something is weird with that league. You are part of the league but the first team in the league doesn't exist. Are you able to to construct a league object for the league?
lg = yfa.League(oauth, '39.l.15338')
lg.teams()
Is your team key object an array still? I had to concatenate mine into a string like this:
def yahoo_login():
print("-- Logging to into Yahoo")
oauth = OAuth2(None, None, from_file='oauth.json')
game = yfa.Game(oauth, 'nfl')
print("-- Logged in to Yahoo")
game_id_array = game.league_ids(year=2020)
game_id_str = ''.join(map(str, game_id_array))
league = yfa.League(oauth, game_id_str)
print("-- Created local Yahoo league to extract info from")
return league
So that it would work properly, doesn't look as clean but works!
@Demon-tk, league_ids
returns an array in case you are in multiple leagues. What you have above only works if you are in a single league. You can just as easily reference the first element in the array and pass that through when creating the League
object. @Phloot opened the issue because the league_ids
call dies with a bad response from Yahoo!
When attempting to return league_ids with a year specified, a RuntimeError is returned.
Code:
Returns:
I am able to successfully return league information, team information, etc if I manually input the league ID, however it makes it much more difficult to automate the querying of data if I manually need to identify the game ID for the current year (it is 399 for 2020 NFL for example) and league ID.
I also do not recognize the game ID (39), or league ID (15338) being returned in the traceback.
Any thoughts?