Skip to content

Commit

Permalink
Merge pull request #208 from cwendt94/FreeAgentFix
Browse files Browse the repository at this point in the history
Football Free Agent Fix Off Season Lookup
  • Loading branch information
cwendt94 authored May 12, 2021
2 parents b89bbc4 + 266fb72 commit 196cd98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions espn_api/base_league.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ def _get_pro_schedule(self, scoringPeriodId: int = None):
pro_team_schedule = {}

for team in pro_teams:
if team['id'] != 0 and (str(scoringPeriodId) in team['proGamesByScoringPeriod'].keys() and team['proGamesByScoringPeriod'][str(scoringPeriodId)]):
game_data = team['proGamesByScoringPeriod'][str(scoringPeriodId)][0]
pro_game = team.get('proGamesByScoringPeriod', {})
if team['id'] != 0 and (str(scoringPeriodId) in pro_game.keys() and pro_game[str(scoringPeriodId)]):
game_data = pro_game[str(scoringPeriodId)][0]
pro_team_schedule[team['id']] = (game_data['homeProTeamId'], game_data['date']) if team['id'] == game_data['awayProTeamId'] else (game_data['awayProTeamId'], game_data['date'])
return pro_team_schedule

Expand Down
2 changes: 1 addition & 1 deletion espn_api/football/league.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _get_positional_ratings(self, week: int):
'scoringPeriodId': week,
}
data = self.espn_request.league_get(params=params)
ratings = data['positionAgainstOpponent']['positionalRatings']
ratings = data.get('positionAgainstOpponent', {}).get('positionalRatings', {})

positional_ratings = {}
for pos, rating in ratings.items():
Expand Down

0 comments on commit 196cd98

Please sign in to comment.