From 16a1c5cceea3390387a7572208fe090b4f387e4b Mon Sep 17 00:00:00 2001 From: Jason Freeberg Date: Tue, 5 Nov 2024 12:44:14 -0600 Subject: [PATCH] Handle bye weeks in string representation If you print a matchup object where there is a bye week, it fails with an error because there is no away team. --- espn_api/football/matchup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/espn_api/football/matchup.py b/espn_api/football/matchup.py index b5fa5262..c808f5d3 100644 --- a/espn_api/football/matchup.py +++ b/espn_api/football/matchup.py @@ -11,7 +11,11 @@ def __init__(self, data): self.away_team: Team def __repr__(self): - return f'Matchup({self.home_team}, {self.away_team})' + if hasattr(self, 'away_team'): + return f'Matchup({self.home_team}, {self.away_team})' + else: + return f'Matchup({self.home_team}, N/A)' + def _fetch_matchup_info(self, data, team): '''Fetch info for matchup'''