Welcome to Fli Documentation¶
Fli is a powerful Python library that provides direct access to Google Flights' API through reverse engineering. Unlike other flight search libraries that rely on web scraping, Fli offers a clean, fast, and reliable way to search for flights and analyze pricing data.
Key Features¶
🚀 Direct API Access¶
- No web scraping or browser automation
- Fast and reliable results
- Less prone to breaking from UI changes
- Clean, modular architecture
🔍 Search Capabilities¶
- One-way flight searches
- Flexible departure times
- Multi-airline support
- Various cabin classes
- Stop preferences
- Custom result sorting
💰 Price Analysis¶
- Search across date ranges
- Find cheapest dates to fly
- Price tracking and analysis
- Flexible date options
Quick Start¶
Installation¶
# Install using pip
pip install flights
# Or install using pipx (recommended for CLI usage)
pipx install flights
Basic Usage¶
from datetime import datetime, timedelta
from fli.models import Airport, PassengerInfo, SeatType, MaxStops, SortBy
from fli.search import SearchFlights, SearchFlightsFilters
# Create search filters
filters = SearchFlightsFilters(
departure_airport=Airport.JFK,
arrival_airport=Airport.LAX,
departure_date=(datetime.now() + timedelta(days=30)).strftime("%Y-%m-%d"),
passenger_info=PassengerInfo(adults=1),
seat_type=SeatType.ECONOMY,
stops=MaxStops.NON_STOP,
sort_by=SortBy.CHEAPEST,
)
# Search flights
search = SearchFlights()
flights = search.search(filters)
# Process results
for flight in flights:
print(f"💰 Price: ${flight.price}")
print(f"⏱️ Duration: {flight.duration} minutes")
print(f"✈️ Stops: {flight.stops}")
Project Structure¶
The library is organized into several key modules:
-
models/
: Data models and enumsgoogle_flights.py
: Core data modelsairline.py
: Airline enums and dataairport.py
: Airport enums and data
-
search/
: Search functionalityflights.py
: Flight search implementationdates.py
: Date-based price searchclient.py
: HTTP client with rate limiting
Contributing¶
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
poetry run pytest
- Submit a pull request
License¶
This project is licensed under the MIT License. See the LICENSE file for details.