Skip to main content

sprint_results.py

The sprint_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 the SprintResultsFetcher 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
Parameters:
  • race (dict): Race information object
Returns:
  • bool: True if race has a sprint, False otherwise

get_sprint_results()

Fetches sprint results from the API.
sprint_results.py
Parameters:
  • season (int): F1 season year
  • round_num (int): Round number
Returns:
  • dict: Sprint results data or None

fetch_sprint_for_round()

Main method to fetch and save sprint results.
sprint_results.py
Parameters:
  • season (int): F1 season year
  • round_num (int): Round number
Returns:
  • bool: True if sprint results were successfully saved, False otherwise

Usage

Basic Usage

Fetch All Sprints in a Season

API Endpoint

Example:

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
2023-Present Format:
  • 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

  1. Friday: Practice + Sprint Qualifying
  2. Saturday: Sprint Race + Main Qualifying
  3. Sunday: Grand Prix

Sprint Races by Season

Check the official F1 calendar at the start of each season to see which races will feature sprint formats.

Checking for Sprints

The script automatically detects sprint races by checking the race object for a Sprint field:

Logging

Log file: sprint_results_fetch.log

See Also