Skip to content

Commit

Permalink
Fixed directly calling a potentially missing key in a dict
Browse files Browse the repository at this point in the history
Fixes #603
  • Loading branch information
monsdar authored Oct 31, 2024
1 parent be5e92b commit a84554b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion espn_api/basketball/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, data, year, pro_team_schedule = None):
applied_avg = round(split.get('appliedAverage', 0), 2)
game = self.schedule.get(id, {})
self.stats[id] = dict(applied_total=applied_total, applied_avg=applied_avg, team=game.get('team', None), date=game.get('date', None))
if split['stats']:
if split.get('stats'):
if 'averageStats' in split.keys():
self.stats[id]['avg'] = {STATS_MAP.get(i, i): split['averageStats'][i] for i in split['averageStats'].keys() if STATS_MAP.get(i) != ''}
self.stats[id]['total'] = {STATS_MAP.get(i, i): split['stats'][i] for i in split['stats'].keys() if STATS_MAP.get(i) != ''}
Expand Down

0 comments on commit a84554b

Please sign in to comment.