Skip to content

Commit

Permalink
Merge pull request #529 from cwendt94/fix-basketball-team-schedule-home
Browse files Browse the repository at this point in the history
fix: Basketball Team Schedule Home not Always Present
  • Loading branch information
cwendt94 authored Feb 21, 2024
2 parents 81f6d2f + 247a40a commit b24d467
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions espn_api/basketball/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ def _fetch_schedule(self, data):
'''Fetch schedule and scores for team'''
for match in data:
if 'away' in match.keys():
if match['away']['teamId'] == self.team_id:
if match.get('away', {}).get('teamId', -1) == self.team_id:
new_match = Matchup(match)
setattr(new_match, 'away_team', self)
self.schedule.append(new_match)
elif match['home']['teamId'] == self.team_id:
elif match.get('home', {}).get('teamId', -1) == self.team_id:
new_match = Matchup(match)
setattr(new_match, 'home_team', self)
self.schedule.append(new_match)

0 comments on commit b24d467

Please sign in to comment.