cwendt94 / espn-api

ESPN Fantasy API! (Football, Basketball)
MIT License
649 stars 205 forks source link

Unable to get projected points for 2020 Season #93

Closed scotttravel2005 closed 4 years ago

scotttravel2005 commented 4 years ago

I may be missing something regarding working with the 2020 season, but it seems as though there is not box_score information for the week 1 upcoming season 2020. I looked through the JSON views according to other posts and did not see a projected score per player, but on the app/site there are definitely projections for week 1, 2020. Is there another way to get the pre-season projections?

Looking to compare ESPN's player projections with other sites leading up to 2020.

cwendt94 commented 4 years ago

Hmm if your league has already drafted you should be able to get week 1 box scores. What is returned when calling box_scores()?

scotttravel2005 commented 4 years ago

Thanks for looking at this:

=============== trace ----> 1 box_scores = league.box_scores(week=1)

~/virtualenv/py36-kerastf/lib/python3.6/site-packages/espn_api/football/league.py in box_scores(self, week) 202 pro_schedule = self._get_pro_schedule(week) 203 positional_rankings = self._get_positional_ratings(week) --> 204 box_data = [BoxScore(matchup, pro_schedule, positional_rankings, week) for matchup in schedule] 205 206 for team in self.teams:

~/virtualenv/py36-kerastf/lib/python3.6/site-packages/espn_api/football/league.py in (.0) 202 pro_schedule = self._get_pro_schedule(week) 203 positional_rankings = self._get_positional_ratings(week) --> 204 box_data = [BoxScore(matchup, pro_schedule, positional_rankings, week) for matchup in schedule] 205 206 for team in self.teams:

~/virtualenv/py36-kerastf/lib/python3.6/site-packages/espn_api/football/box_score.py in init(self, data, pro_schedule, positional_rankings, week) 7 self.home_score = round(data['home']['rosterForCurrentScoringPeriod']['appliedStatTotal'], 2) 8 home_roster = data['home']['rosterForCurrentScoringPeriod']['entries'] ----> 9 self.home_lineup = [BoxPlayer(player, pro_schedule, positional_rankings, week) for player in home_roster] 10 11 # For Leagues with bye weeks

~/virtualenv/py36-kerastf/lib/python3.6/site-packages/espn_api/football/box_score.py in (.0) 7 self.home_score = round(data['home']['rosterForCurrentScoringPeriod']['appliedStatTotal'], 2) 8 home_roster = data['home']['rosterForCurrentScoringPeriod']['entries'] ----> 9 self.home_lineup = [BoxPlayer(player, pro_schedule, positional_rankings, week) for player in home_roster] 10 11 # For Leagues with bye weeks

~/virtualenv/py36-kerastf/lib/python3.6/site-packages/espn_api/football/box_player.py in init(self, data, pro_schedule, positional_rankings, week) 23 if str(player['defaultPositionId']) in positional_rankings: 24 self.pro_opponent = PRO_TEAM_MAP[opp_id] ---> 25 self.pro_pos_rank = positional_rankings[str(player['defaultPositionId'])][str(opp_id)] 26 27

KeyError: '16'

scotttravel2005 commented 4 years ago

Here is the league (public):

https://fantasy.espn.com/apis/v3/games/ffl/seasons/2020/segments/0/leagues/63281490?view=mMatchup&view=mMatchScore

cwendt94 commented 4 years ago

Awesome, thanks for the information! It looks like before the season starts NFL team's defenses do not have ranks against positions yet (which makes sense). I should have the fix soon!

cwendt94 commented 4 years ago

This is fixed in the newest package version 0.3.2