From c4facf34500ee14c1aacf7bce69a4c86fb6250c3 Mon Sep 17 00:00:00 2001 From: Christian Wendt Date: Tue, 24 Jan 2023 04:08:04 +0000 Subject: [PATCH] Basketball Box Score Home Team not Present --- espn_api/basketball/box_score.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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"