Skip to main content
This guide covers everything you need to install and configure F1 Stats Archive on your system.

System Requirements

Python Version

F1 Stats Archive requires Python 3.7 or higher. The project uses modern Python features including:
  • pathlib for cross-platform file paths
  • Type hints and f-strings
  • Context managers for file operations
Verify your Python version:

Operating System

The project is compatible with:
  • Linux (Ubuntu, Debian, Fedora, etc.)
  • macOS
  • Windows 10/11

Installation Methods

Standard Installation

1

Clone the repository

2

Create a virtual environment (recommended)

Using a virtual environment keeps your project dependencies isolated:
3

Install dependencies

Install the required packages from requirements.txt:
The only dependency is:
  • requests - For making HTTP requests to the Ergast API
4

Verify installation

Test that everything is working by importing the modules:

Configuration

API Settings

The Ergast API base URL is configured in each script. By default, all scripts use:
The Ergast API is currently hosted at api.jolpi.ca/ergast. The original ergast.com domain is no longer operational.

Rate Limiting

All scripts include built-in rate limiting to comply with API restrictions:
  • Burst limit: 4 requests per second
  • Sustained limit: 500 requests per hour
The rate limiting is implemented in each fetcher class:

Directory Structure

By default, all scripts save data to the current working directory. You can customize the output location:
The generated directory structure:

Logging Configuration

Each script includes comprehensive logging to help you track progress and debug issues:
Log files are created in the current directory:
  • race_results_fetch.log - Race results fetching
  • qualifying_results_fetch.log - Qualifying results
  • driver_standings_fetch.log - Driver points
  • laptimes_fetch.log - Lap timing data
You can adjust the log level in any script:

Customizing Season and Round Selection

Each script is configured to fetch specific seasons and rounds. Modify the __main__ section of each script:

Events Script

Results, Qualifying, and Points Scripts

Verification

After installation, verify everything works by running the events script:
You should see output like:
Always run events.py first to create the directory structure and fetch event data. Other scripts depend on the events.json file to determine race names and folder locations.

Troubleshooting

Import Errors

If you see ModuleNotFoundError: No module named 'requests':

Rate Limit Errors

If you see frequent rate limit warnings:
  • The scripts will automatically retry after 30 seconds
  • Consider increasing the delay between requests
  • Avoid running multiple scripts simultaneously

Permission Errors

If you encounter permission errors when creating directories:

Missing Data

If race folders are created but contain no JSON files:
  • Check that the race has occurred (future races have no data)
  • Verify your internet connection
  • Check the log files for error messages
  • The Ergast API may not have data for very recent races yet

Next Steps

Quick Start

Learn how to fetch your first F1 race data

API Reference

Explore all available scripts and methods