Skip to content

Commit

Permalink
Merge pull request #604 from monsdar/patch-1
Browse files Browse the repository at this point in the history
Fixed directly calling a potentially missing key in a dict
  • Loading branch information
cwendt94 authored Nov 1, 2024
2 parents 0fcab3f + a84554b commit 8f714a1
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 8f714a1

Please sign in to comment.