From f31f0b8fbd60fc6d6af1a8b842940d6f6bb839a4 Mon Sep 17 00:00:00 2001 From: Robbie Date: Thu, 28 Nov 2024 13:12:40 -0500 Subject: [PATCH] moved JSON checking from base_league to espn_requests for 2018 data --- espn_api/base_league.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/espn_api/base_league.py b/espn_api/base_league.py index c0b97fa7..4c69e599 100644 --- a/espn_api/base_league.py +++ b/espn_api/base_league.py @@ -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'] @@ -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