Skip to content

Commit

Permalink
Update lines 30-34 in base_league.py to account for 2018 JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-litts authored Dec 12, 2023
1 parent c4d04b5 commit 4a31603
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions espn_api/base_league.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def __repr__(self):
return 'League(%s, %s)' % (self.league_id, self.year, )

def _fetch_league(self, SettingsClass = BaseSettings):
data = self.espn_request.get_league()
if self.year == 2018:
data = self.espn_request.get_league()[0]
else:
data = self.espn_request.get_league()

self.currentMatchupPeriod = data['status']['currentMatchupPeriod']
self.scoringPeriodId = data['scoringPeriodId']
Expand Down Expand Up @@ -101,4 +104,4 @@ def _get_all_pro_schedule(self):

def standings(self) -> List:
standings = sorted(self.teams, key=lambda x: x.final_standing if x.final_standing != 0 else x.standing, reverse=False)
return standings
return standings

0 comments on commit 4a31603

Please sign in to comment.