From 49563e35584658bab95faeec9f775e5558f872da Mon Sep 17 00:00:00 2001 From: Christian Wendt Date: Mon, 18 Jul 2022 15:53:03 +0000 Subject: [PATCH] Baseball Player Handle Unknown Position --- espn_api/baseball/player.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/espn_api/baseball/player.py b/espn_api/baseball/player.py index 69561743..86161a61 100644 --- a/espn_api/baseball/player.py +++ b/espn_api/baseball/player.py @@ -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 = {}