diff --git a/espn_api/basketball/box_score.py b/espn_api/basketball/box_score.py index 5b36e9e7..bd1bda72 100644 --- a/espn_api/basketball/box_score.py +++ b/espn_api/basketball/box_score.py @@ -7,10 +7,9 @@ class BoxScore(ABC): ''' ''' def __init__(self, data): self.winner = data.get('winner', 'UNDECIDED') - self.home_team = data['home']['teamId'] - self.away_team = 0 - if 'away' in data: - self.away_team = data['away']['teamId'] + self.home_team = data.get('home', {}).get('teamId', 0) + self.away_team = data.get('away', {}).get('teamId', 0) + def __repr__(self): away_team = self.away_team or "BYE" home_team = self.home_team or "BYE"