supercontest.core.scores
Logic for fetching NFL scores and committing them to the database.
Functions
Wrapper for all score committing functionality. |
|
Hits the ESPN API for live score updates and the time status of the game (quarter, final, etc). |
- supercontest.core.scores.commit_scores(verify: bool = True) bool
Wrapper for all score committing functionality. The logic for is-offseason and is-score-day is checked here, since that’s fundamental to all cases of scoring. The other case of “did the user request an old week/season” is handled in the view logic, naturally.
- Parameters:
verify – Whether or not to check if there’s an active game, skipping if not.
- Returns:
Whether or not scores were committed.
- supercontest.core.scores.fetch_scores(sbsc_games: list[Game]) tuple[list[Game], list[ScoresFetch]]
Hits the ESPN API for live score updates and the time status of the game (quarter, final, etc). Doesn’t need a full webdriver, it’s a static xml return.
Note that ESPN lists by location, which does not differentiate the Los Angeles teams. So we have to hit our own DB for the Game objects for this week, to infer the ESPN scores by opponent.
- Parameters:
sbsc_games – The response from the game fetch.
- Returns:
The SBSC Game objects and ESPN score objects, in the same order.