cwendt94 / espn-api

ESPN Fantasy API! (Football, Basketball)
MIT License
544 stars 183 forks source link

Pulling League Data Errors in new season 23-24 #489

Closed AliFakharany closed 8 months ago

AliFakharany commented 8 months ago

Sport

Basketball

Summary

On October 24 before the NBA season kicked off the league object was working fine.

league = League(league_id=1245, year=2024, espn_s2='ASCWDWheghjwwqfwjqhgjkjgegkje', swid='{03JFJHW-FWFWF-044G}')

On October 25, after the season kicked off, it is throwing a keyerror when pulling the teamClass

The error is occurring in line 11 of the "team.py" file in the "espn_api/basketball" directory. The error is a KeyError, indicating that the key 'location' is not present in the 'data' dictionary.

This may have happened in other sports as well - seems like ESPN has changed Team Data? https://github.com/cwendt94/espn-api/pull/472

Logs/Data

File "/home/runner/Zplash/venv/lib/python3.8/site-packages/espn_api/basketball/league.py", line 23, in init self.fetch_league() File "/home/runner/Zplash/venv/lib/python3.8/site-packages/espn_api/basketball/league.py", line 27, in fetch_league self._fetch_teams(data) File "/home/runner/Zplash/venv/lib/python3.8/site-packages/espn_api/basketball/league.py", line 49, in _fetch_teams super()._fetch_teams(data, TeamClass=Team) File "/home/runner/Zplash/venv/lib/python3.8/site-packages/espn_api/base_league.py", line 63, in _fetch_teams self.teams.append(TeamClass(team, roster=roster, member=member, schedule=schedule, year=seasonId)) File "/home/runner/Zplash/venv/lib/python3.8/site-packages/espn_api/basketball/team.py", line 11, in init self.team_name = "%s %s" % (data['location'], data['nickname']) KeyError: 'location'

AliFakharany commented 8 months ago

Think this was handled in this commit but this commit failed a test?

https://github.com/cwendt94/espn-api/commit/cc82818bada7bda0e12fb10688943fbb46103bd2