Skip to content

Instantly share code, notes, and snippets.

@dtcarls
Last active January 4, 2022 18:17
Show Gist options
  • Save dtcarls/decff6ab5603d6a85ef85518870a2469 to your computer and use it in GitHub Desktop.
Save dtcarls/decff6ab5603d6a85ef85518870a2469 to your computer and use it in GitHub Desktop.
most playoff points
import requests
import json
import os
import random
from espn_api.football import League
#Palmetto
league_id = 164483
# chs
# league_id = 205018
league = League(league_id=league_id, year=2021, debug=True)
playoff_start = league.settings.reg_season_count+1
playoffs_end = len(league.settings.matchup_periods)
totals={}
while playoff_start <= playoffs_end:
box_scores = league.box_scores(week=playoff_start)
for i in box_scores:
totals[i.home_team.team_name]=int(totals.get(i.home_team.team_name) or 0)+i.home_score
if i.away_team:
totals[i.away_team.team_name]=int(totals.get(i.away_team.team_name) or 0)+i.away_score
playoff_start += 1
totals = sorted(totals.items(), key=lambda tup: tup[1], reverse=True)
print(totals)
print(*totals, sep = "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment