tif1 API is designed to be simple, predictable, and compatible with fastf1. Most users will only need to interact with the top-level functions and the Session object.
Quick Start
Entry Points
| Function | Purpose | Documentation |
|---|---|---|
get_session() | Load data for a specific GP session | Core API |
get_events() | List all available Grand Prix events for a year | Events API |
get_sessions() | List all available sessions for an event | Events API |
get_config() | Access global configuration | Config API |
get_cache() | Access cache management | Cache API |
Core Objects
Once you have aSession, you can navigate the data hierarchy:
Primary Objects
- Session: Represents an entire F1 session. Contains all laps, drivers, weather, and race control data.
- Driver: Represents a specific driver within a session. Provides convenient access to driver-specific data.
- Lap: Represents a single lap by a driver, containing high-frequency telemetry data.
Data Models
- Laps: Collection of lap data with filtering methods
- Telemetry: High-frequency telemetry data (Speed, RPM, Throttle, etc.)
- SessionResults: Final classification and results
- CircuitInfo: Circuit metadata and track information
API Categories
Core data access
Essential APIs for loading and working with F1 data:- Core API - Session, Driver, Lap classes and data loading
- Models - Data model classes and structures
- Events - Event and session discovery
- Schedule - Schedule validation and schema
Data Pipeline
Internal data transformation and fetching:- I/O Pipeline - DataFrame construction and transformation
- Async Fetch - Parallel HTTP fetching with niquests
- HTTP - HTTP session and networking
- HTTP Session - Connection pooling and DoH support
- CDN - Multi-source CDN management with fallback
Configuration & Cache
Performance and reliability management:- Config - Global configuration management
- Cache - SQLite-backed caching system
- Retry - Circuit breaker and retry logic
Visualization & Tools
User-facing utilities:- Plotting - F1-themed visualization utilities
- CLI - Command-line interface
- Jupyter - Notebook integration and rich displays
Utilities & Helpers
Supporting functionality:- Utils - General utility functions
- Utilities - Helper functions for configuration and logging
- Core Utils - Internal utilities for DataFrame operations
- Types - Type definitions and hints
- Validation - Pydantic models and data validation
- Fuzzy - Fuzzy string matching for event/session names
- Lap Operations - Utilities for working with lap data
Compatibility & Errors
Integration and error handling:- FastF1 Compat - FastF1 compatibility layer
- Exceptions - Exception hierarchy and error handling
Common Workflows
Load and explore session
Analyze driver performance
Parallel data loading
Configuration and Optimization
Error Handling
tif1 uses a hierarchy of specific exceptions to help you handle common issues:
Exception Hierarchy
Common Exceptions
DataNotFoundError: The requested GP, year, or session doesn’t existNetworkError: All CDN sources failed or timed outInvalidDataError: The data fetched from the CDN was corruptedDriverNotFoundError: The driver code provided is not in this sessionLapNotFoundError: The requested lap number does not exist for this driverCacheError: Cache operation failedSessionNotLoadedError: Attempted to access data before loading session
Error handling example
Performance Tips
-
Use async methods for parallel loading: 5-10x faster than sequential
-
Enable ultra-cold start for single queries: Minimal latency
-
Use polars lib for large datasets: Better memory efficiency
-
Disable validation in production: 10-15% performance boost
-
Increase concurrency for bulk operations: Faster parallel fetching
Type Hints
All public APIs include comprehensive type hints for better IDE support:Next Steps
- Core API - Start with Session, Driver, and Lap classes
- Tutorials - Learn through practical examples
- Best Practices - Optimize your code
- FAQ - Common questions and answers
Related Pages
Core API
Session, Driver, Lap
Models
Data models
Events
Event discovery
Examples
Code examples