Skip to content

Commit

Permalink
Baseball Player Handle Unknown Position
Browse files Browse the repository at this point in the history
  • Loading branch information
cwendt94 authored Jul 18, 2022
1 parent 8f047bb commit 49563e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions espn_api/baseball/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ class Player(object):
def __init__(self, data):
self.name = json_parsing(data, 'fullName')
self.playerId = json_parsing(data, 'id')
self.position = POSITION_MAP[json_parsing(data, 'defaultPositionId') - 1]
self.position = POSITION_MAP.get(json_parsing(data, 'defaultPositionId') - 1, json_parsing(data, 'defaultPositionId') - 1)
self.lineupSlot = POSITION_MAP.get(data.get('lineupSlotId'), '')
self.eligibleSlots = [POSITION_MAP.get(pos, pos) for pos in json_parsing(data, 'eligibleSlots')] # if position isn't in position map, just use the position id number
self.acquisitionType = json_parsing(data, 'acquisitionType')
self.proTeam = PRO_TEAM_MAP[json_parsing(data, 'proTeamId')]
self.proTeam = PRO_TEAM_MAP.get(json_parsing(data, 'proTeamId'), json_parsing(data, 'proTeamId'))
self.injuryStatus = json_parsing(data, 'injuryStatus')
self.stats = {}

Expand Down

0 comments on commit 49563e3

Please sign in to comment.