sprint_results.py
Thesprint_results.py script fetches results from Formula 1 sprint races. Sprint races are shorter format races introduced in 2021 that determine part of the starting grid for the main Grand Prix.
Overview
This script uses theSprintResultsFetcher class to:
- Fetch sprint race results from the Ergast API
- Check if a race weekend includes a sprint
- Save sprint results to structured JSON files
- Handle races that don’t have sprints gracefully
Sprint races were introduced in 2021. Only select races each season feature sprint formats.
SprintResultsFetcher Class
Initialization
sprint_results.py
Key Methods
has_sprint()
Checks if a race has a sprint event.sprint_results.py
race(dict): Race information object
bool:Trueif race has a sprint,Falseotherwise
get_sprint_results()
Fetches sprint results from the API.sprint_results.py
season(int): F1 season yearround_num(int): Round number
dict: Sprint results data orNone
fetch_sprint_for_round()
Main method to fetch and save sprint results.sprint_results.py
season(int): F1 season yearround_num(int): Round number
bool:Trueif sprint results were successfully saved,Falseotherwise
Usage
Basic Usage
Fetch All Sprints in a Season
API Endpoint
Output Structure
Sprint results are saved to:{year}/{race-slug}/sprint_results.json
Sprint Race Format
Sprint races have evolved since their introduction:Points Distribution
2021-2022 Format:- P1: 3 points
- P2: 2 points
- P3: 1 point
- P1: 8 points
- P2: 7 points
- P3: 6 points
- P4: 5 points
- P5: 4 points
- P6: 3 points
- P7: 2 points
- P8: 1 point
Sprint Weekend Schedule
- Friday: Practice + Sprint Qualifying
- Saturday: Sprint Race + Main Qualifying
- Sunday: Grand Prix
Sprint Races by Season
Checking for Sprints
The script automatically detects sprint races by checking the race object for aSprint field:
Logging
Log file:sprint_results_fetch.log