Skip to content

Commit

Permalink
moved JSON checking from base_league to espn_requests for 2018 data
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbie authored and Robbie committed Nov 28, 2024
1 parent cbbe230 commit f31f0b8
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions espn_api/base_league.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ def __repr__(self):

def _fetch_league(self, SettingsClass = BaseSettings):
data = self.espn_request.get_league()

# Check if the data is a list (which happens when year is 2018 for some leagues)
if isinstance(data, list):
# If it's a list, we assume the relevant data is at index 0
data = data[0]


self.currentMatchupPeriod = data['status']['currentMatchupPeriod']
self.scoringPeriodId = data['scoringPeriodId']
self.firstScoringPeriod = data['status']['firstScoringPeriod']
Expand All @@ -55,12 +48,6 @@ def _fetch_league(self, SettingsClass = BaseSettings):
def _fetch_draft(self):
'''Creates list of Pick objects from the leagues draft'''
data = self.espn_request.get_league_draft()

# Check if the data is a list (which happens when year is 2018 or earlier)
if isinstance(data, list):
# If it's a list, we assume the relevant data is at index 0
data = data[0]

# League has not drafted yet
if not data.get('draftDetail', {}).get('drafted'):
return
Expand Down

0 comments on commit f31f0b8

Please sign in to comment.