diff --git a/espn_api/hockey/player.py b/espn_api/hockey/player.py index 5082acb6..4941b7e6 100644 --- a/espn_api/hockey/player.py +++ b/espn_api/hockey/player.py @@ -7,9 +7,9 @@ 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')] + self.position = POSITION_MAP.get(json_parsing(data, 'defaultPositionId'), '') self.lineupSlot = POSITION_MAP.get(data.get('lineupSlotId'), '') - self.eligibleSlots = [POSITION_MAP[pos] for pos in json_parsing(data, 'eligibleSlots')] + self.eligibleSlots = [POSITION_MAP.get(pos, '') for pos in json_parsing(data, 'eligibleSlots')] self.acquisitionType = json_parsing(data, 'acquisitionType') self.proTeam = PRO_TEAM_MAP.get(json_parsing(data, 'proTeamId'), 'Unknown Team') self.injuryStatus = json_parsing(data, 'injuryStatus')