cwendt94/espn-api

ESPN API Updated Key Names for Team Name

johnny-papercut opened this issue · 1 comments

Sport

Football

Summary

The ESPN API has updated to now use the "name" key instead of a combination of "location" plus "nickname".

Line 8 in espn_api/football/team.py needs updated with the new key (tested locally).

Logs/Data

Traceback (most recent call last):
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/Users/johnny.papercut/PycharmProjects/fantasy/main.py", line 401, in index_week
'points': get_current_points(data, league.get('platform'), league.get('league_id'), league.get('scoring'), week)
File "/Users/johnny.papercut/PycharmProjects/fantasy/main.py", line 38, in get_current_points
league = helpers.initialize_espn_league(league_id, 2023)
File "/Users/johnny.papercut/PycharmProjects/fantasy/helpers.py", line 68, in initialize_espn_league
return League(league_id=league_id, year=year, espn_s2=s2, swid=swid)
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/espn_api/football/league.py", line 24, in init
self.fetch_league()
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/espn_api/football/league.py", line 27, in fetch_league
self._fetch_league()
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/espn_api/football/league.py", line 34, in _fetch_league
self._fetch_teams(data)
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/espn_api/football/league.py", line 39, in _fetch_teams
super()._fetch_teams(data, TeamClass=Team)
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/espn_api/base_league.py", line 64, in _fetch_teams
self.teams.append(TeamClass(team, roster=roster, member=member, schedule=schedule, year=seasonId, pro_schedule=pro_schedule))
File "/Users/johnny.papercut/PycharmProjects/fantasy/venv/lib/python3.9/site-packages/espn_api/football/team.py", line 8, in init
self.team_name = "%s %s" % (data['location'], data['nickname'])
KeyError: 'location'

Had outdated version, please ignore.