From c931b16fda57e25563fb1c9352f029a90fa76726 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 26 Mar 2021 12:35:27 -0700 Subject: [PATCH] Handle No Home Team in Matchup --- espn_api/basketball/league.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espn_api/basketball/league.py b/espn_api/basketball/league.py index 3bdb6b5d..11cd6b4a 100644 --- a/espn_api/basketball/league.py +++ b/espn_api/basketball/league.py @@ -33,7 +33,7 @@ def _map_matchup_ids(self, schedule): self.matchup_ids = {} for match in schedule: matchup_period = match.get('matchupPeriodId') - scoring_periods = match['home'].get('pointsByScoringPeriod', {}).keys() + scoring_periods = match.get('home', {}).get('pointsByScoringPeriod', {}).keys() if len(scoring_periods) > 0: if matchup_period not in self.matchup_ids: self.matchup_ids[matchup_period] = sorted(scoring_periods)