Skip to main content
The pitstops.py script fetches detailed pit stop information including lap number, stop duration, and timing for each driver’s pit stops.
Pit stop data is only available from the 2011 season onwards. The script automatically skips seasons before 2011.

Script Overview

Location: ~/workspace/source/pitstops.py The PitstopsFetcher class:
  1. Fetches pit stop data with pagination
  2. Validates that the season is 2011 or later
  3. Combines paginated results into a single file
  4. Handles races with no pit stops (e.g., safety car finishes)

API Endpoint with Pagination

PitstopsFetcher Class

Initialization

Fetch Pitstops with Pagination

Run Method with Season Validation

Output Structure

Stored at: {year}/{race-name}/pitstops.json

Pit Stop Data Fields

The duration field is particularly useful for analyzing pit crew performance and comparing stop times.

Usage Example

Single Race

Multiple Races

With Season Validation

Pagination Example

For a typical race:
  • 20 drivers × 2-3 stops each = 40-60 pit stops
  • Usually fits in a single 100-record request
  • High-strategy races may require multiple requests

Race Strategy Analysis

Pit stop data enables various analyses:

Pit Stop Statistics

Strategy Comparison

Data Availability Timeline

Attempting to fetch pit stop data for seasons before 2011 will return empty results. The script automatically detects and skips these seasons.

Logging

Lap Times

Compare with lap timing data

Race Results

Analyze how pit strategy affected results

Sprint Races

Fetch sprint race data (2021+)