fixed try

This commit is contained in:
Death916 2025-03-23 06:13:00 -07:00
parent 747af41ddc
commit de62412e8a

View file

@ -62,24 +62,22 @@ class mlbScores:
return [] return []
def get_scores(self): def get_scores(self):
try: games = self.get_games()
games = self.get_games() scores_list = []
scores_list = [] for game in games:
for game in games: try:
try: game_data = {
game_data = { 'home_team': game['home_name'],
'home_team': game['home_name'], 'home_score': game['home_score'],
'home_score': game['home_score'], 'away_team': game['away_name'],
'away_team': game['away_name'], 'away_score': game['away_score'],
'away_score': game['away_score'], 'status': game['status']
'status': game['status'] }
} scores_list.append(game_data)
scores_list.append(game_data) except KeyError as e:
except KeyError as e: print(f"Error processing game data: {e}")
print(f"Error processing game data: {e}") continue
continue
self._scores = scores_list
if __name__ == "__main__": if __name__ == "__main__":