Skip to content

Maxbleu/APIF1DB

Repository files navigation

APIF1DB

APIF1DB is a comprehensive, unofficial Formula 1 data API built with Python and FastAPI. It provides detailed historical data for Formula 1, from drivers and constructors to individual race results and season standings.

The entire API requires authentication, and access is granted via JWT tokens. The API's interactive documentation, powered by Swagger UI, is available at the root of the application (/).

Installation

You can run the application using Docker (recommended) or by setting up a local Python environment.

With Docker

Prerequisites:

  • Docker installed and running.
  1. Build the image:

    docker build -t apif1db .
  2. Run the container:

    docker run -p 8000:8000 apif1db

The API will be available at http://localhost:8000.

Local Environment

Prerequisites:

  • Python 3.11
  • A running PostgreSQL instance
  1. Clone the repository:

    git clone <repository-url>
    cd APIF1DB
  2. Install dependencies:

    pip install -r requirements.txt
  3. Configure the database: Ensure your PostgreSQL server is running and set the DATABASE_URL environment variable to point to your database.

  4. Run the application:

    uvicorn app.main:app --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000.

Data Managed

This API provides access to a rich and detailed set of Formula 1 historical data, including but not limited to:

  • Seasons: Information on every F1 season.
  • Grands Prix: Details of each race event.
  • Circuits: Data on all racing circuits.
  • Drivers: Comprehensive information about every driver.
  • Constructors: Details on all teams and constructors.
  • Race Results: Final classification for each race.
  • Qualifying Results: Full qualifying session data.
  • Standings: Driver and Constructor championship standings for each race and season.
  • And much more: Including practice sessions, sprint races, fastest laps, and pit stops.

Technology Stack

  • Backend: Python 3.11 with FastAPI
  • Database: PostgreSQL
  • ORM: SQLAlchemy
  • Authentication: JWT (JSON Web Tokens)
  • Containerization: Docker

📜 Licenses

Source Code

The source code of this project is licensed under the Apache License 2.0.

Data

This project uses Formula 1 data from F1DB created by the F1DB contributors, licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) license.

The original data has been:

  • Imported and structured into a PostgreSQL database
  • Exposed through a custom REST API
  • Optimized for efficient querying

The original data is provided "as-is" without warranties of any kind, as per the terms of the CC BY 4.0 license.

For complete attribution details, see ATTRIBUTIONS.md..

Notice

F1Analisys is unofficial and are not associated in any way with the Formula 1 companies. F1, FORMULA ONE, FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX and related marks are trade marks of Formula One Licensing B.V.

About

FastAPI Server to comunicate with your local F1DB.

Topics

Resources

License

Contributing

Stars

Watchers

Forks