cwendt94 / espn-api

ESPN Fantasy API! (Football, Basketball)
MIT License
613 stars 198 forks source link

KeyError: 'location' in Fantasy BBall H2H Categories #495

Closed JamesPHawk closed 11 months ago

JamesPHawk commented 11 months ago

Sport

Basketball

Summary

Trying to make a basic connection to my private H2H categories league with this

league = League(league_id=league_id, year=year, espn_s2=espn_s2, swid=swid, debug=False)

Getting this error block at runtime

Traceback (most recent call last):
  File "my file", line 21, in <module>
    league = League(league_id=league_id, year=year, espn_s2=espn_s2, swid=swid, debug=False)
  File "\espn_api\basketball\league.py", line 25, in __init__
    self.fetch_league()
  File "\espn_api\basketball\league.py", line 29, in fetch_league
    self._fetch_teams(data)
  File "\espn_api\basketball\league.py", line 51, in _fetch_teams
    super()._fetch_teams(data, TeamClass=Team)
  File "\espn_api\base_league.py", line 65, in _fetch_teams
    self.teams.append(TeamClass(team, roster=roster, member=member, schedule=schedule, year=seasonId))
  File "\espn_api\basketball\team.py", line 11, in __init__
    self.team_name = "%s %s" % (data['location'], data['nickname'])
KeyError: 'location'

Some other threads have been raised in different sports, not sure what I could be missing but it's been a minute since I've used this API so I could be missing something.

Logs/Data

No response

goose-36 commented 11 months ago

@JamesPHawk this issue has been rectified already. Check the closed issues. I fell victim of not reading the closed issues as well...

cwendt94 commented 11 months ago

Make sure to update to the latest version v0.33.0, that has the fix for this.