# Fli š«
A powerful Python library that provides programmatic access to Google Flights data with an elegant CLI interface. Search
flights, find the best deals, and filter results with ease.
> š **What makes `fli` special?**
> Unlike other flight search libraries that rely on web scraping, Fli directly interacts with Google Flights' API
> through reverse engineering.
> This means:
> - **Fast**: Direct API access means faster, more reliable results
> - **Zero Scraping**: No HTML parsing, no browser automation, just pure API interaction
> - **Reliable**: Less prone to breaking from UI changes
> - **Modular**: Extensible architecture for easy customization and integration
![CLI Demo](https://github.com/punitarani/fli/blob/main/data/cli-demo.png)
## Quick Start
```bash
pip install flights
```
```bash
# Install using pipx (recommended for CLI)
pipx install flights
# Get started with CLI
fli --help
```
## Features
- š **Powerful Search**
- One-way flight searches
- Flexible departure times
- Multi-airline support
- Cabin class selection
- Stop preferences
- Custom result sorting
- šŗ **Cabin Classes**
- Economy
- Premium Economy
- Business
- First
- šÆ **Smart Sorting**
- Price
- Duration
- Departure Time
- Arrival Time
- š”ļø **Built-in Protection**
- Rate limiting
- Automatic retries
- Comprehensive error handling
- Input validation
## CLI Usage
### Search for Specific Flights
```bash
# Basic search
fli search JFK LHR 2025-10-25
# Advanced search with filters
fli search JFK LHR 2025-10-25 \
-t 6-20 \ # Time range (6 AM - 8 PM)
-a BA KL \ # Airlines (British Airways, KLM)
-s BUSINESS \ # Seat type
-x NON_STOP \ # Non-stop flights only
-o DURATION # Sort by duration
```
### Find Cheapest Dates
```bash
# Basic search for cheapest dates
fli cheap JFK LHR
# Advanced search with date range
fli cheap JFK LHR \
--from 2025-01-01 \
--to 2025-02-01 \
--monday --friday # Only Mondays and Fridays
```
### CLI Options
#### Search Command (`fli search`)
| Option | Description | Example |
|------------------|-------------------------|------------------------|
| `-t, --time` | Time range (24h format) | `6-20` |
| `-a, --airlines` | Airline codes | `BA KL` |
| `-s, --seat` | Cabin class | `ECONOMY`, `BUSINESS` |
| `-x, --stops` | Maximum stops | `NON_STOP`, `ONE_STOP` |
| `-o, --sort` | Sort results by | `CHEAPEST`, `DURATION` |
#### Cheap Command (`fli cheap`)
| Option | Description | Example |
|---------------|---------------|------------------------|
| `--from` | Start date | `2025-01-01` |
| `--to` | End date | `2025-02-01` |
| `-s, --seat` | Cabin class | `ECONOMY`, `BUSINESS` |
| `-x, --stops` | Maximum stops | `NON_STOP`, `ONE_STOP` |
| `--[day]` | Day filters | `--monday`, `--friday` |
## Python API Usage
### Basic Search Example
```python
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}")
for leg in flight.legs:
print(f"\nš« Flight: {leg.airline.value} {leg.flight_number}")
print(f"š From: {leg.departure_airport.value} at {leg.departure_datetime}")
print(f"š To: {leg.arrival_airport.value} at {leg.arrival_datetime}")
```
## Development
```bash
# Clone the repository
git clone https://github.com/punitarani/fli.git
cd fli
# Install dependencies with Poetry
poetry install
# Run tests
poetry run pytest
# Run linting
poetry run ruff check .
poetry run ruff format .
# Build documentation
poetry run mkdocs serve
```
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License ā see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "flights",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": "flights, google-flights, travel, api, flight-search",
"author": "Punit Arani",
"author_email": "punit@joinslash.com",
"download_url": "https://files.pythonhosted.org/packages/50/d3/ab897f44991630a5d9e89da510e34e2aa63147cc8a16aa055df26cacd839/flights-0.4.0.tar.gz",
"platform": null,
"description": "# Fli \ud83d\udeeb\n\nA powerful Python library that provides programmatic access to Google Flights data with an elegant CLI interface. Search\nflights, find the best deals, and filter results with ease.\n\n> \ud83d\ude80 **What makes `fli` special?** \n> Unlike other flight search libraries that rely on web scraping, Fli directly interacts with Google Flights' API\n> through reverse engineering.\n> This means:\n> - **Fast**: Direct API access means faster, more reliable results\n> - **Zero Scraping**: No HTML parsing, no browser automation, just pure API interaction\n> - **Reliable**: Less prone to breaking from UI changes\n> - **Modular**: Extensible architecture for easy customization and integration\n\n![CLI Demo](https://github.com/punitarani/fli/blob/main/data/cli-demo.png)\n\n## Quick Start\n\n```bash\npip install flights\n```\n\n```bash\n# Install using pipx (recommended for CLI)\npipx install flights\n\n# Get started with CLI\nfli --help\n```\n\n## Features\n\n- \ud83d\udd0d **Powerful Search**\n - One-way flight searches\n - Flexible departure times\n - Multi-airline support\n - Cabin class selection\n - Stop preferences\n - Custom result sorting\n\n- \ud83d\udcba **Cabin Classes**\n - Economy\n - Premium Economy\n - Business\n - First\n\n- \ud83c\udfaf **Smart Sorting**\n - Price\n - Duration\n - Departure Time\n - Arrival Time\n\n- \ud83d\udee1\ufe0f **Built-in Protection**\n - Rate limiting\n - Automatic retries\n - Comprehensive error handling\n - Input validation\n\n## CLI Usage\n\n### Search for Specific Flights\n\n```bash\n# Basic search\nfli search JFK LHR 2025-10-25\n\n# Advanced search with filters\nfli search JFK LHR 2025-10-25 \\\n -t 6-20 \\ # Time range (6 AM - 8 PM)\n -a BA KL \\ # Airlines (British Airways, KLM)\n -s BUSINESS \\ # Seat type\n -x NON_STOP \\ # Non-stop flights only\n -o DURATION # Sort by duration\n```\n\n### Find Cheapest Dates\n\n```bash\n# Basic search for cheapest dates\nfli cheap JFK LHR\n\n# Advanced search with date range\nfli cheap JFK LHR \\\n --from 2025-01-01 \\\n --to 2025-02-01 \\\n --monday --friday # Only Mondays and Fridays\n```\n\n### CLI Options\n\n#### Search Command (`fli search`)\n\n| Option | Description | Example |\n|------------------|-------------------------|------------------------|\n| `-t, --time` | Time range (24h format) | `6-20` |\n| `-a, --airlines` | Airline codes | `BA KL` |\n| `-s, --seat` | Cabin class | `ECONOMY`, `BUSINESS` |\n| `-x, --stops` | Maximum stops | `NON_STOP`, `ONE_STOP` |\n| `-o, --sort` | Sort results by | `CHEAPEST`, `DURATION` |\n\n#### Cheap Command (`fli cheap`)\n\n| Option | Description | Example |\n|---------------|---------------|------------------------|\n| `--from` | Start date | `2025-01-01` |\n| `--to` | End date | `2025-02-01` |\n| `-s, --seat` | Cabin class | `ECONOMY`, `BUSINESS` |\n| `-x, --stops` | Maximum stops | `NON_STOP`, `ONE_STOP` |\n| `--[day]` | Day filters | `--monday`, `--friday` |\n\n## Python API Usage\n\n### Basic Search Example\n\n```python\nfrom datetime import datetime, timedelta\nfrom fli.models import Airport, PassengerInfo, SeatType, MaxStops, SortBy\nfrom fli.search import SearchFlights, SearchFlightsFilters\n\n# Create search filters\nfilters = SearchFlightsFilters(\n departure_airport=Airport.JFK,\n arrival_airport=Airport.LAX,\n departure_date=(datetime.now() + timedelta(days=30)).strftime(\"%Y-%m-%d\"),\n passenger_info=PassengerInfo(adults=1),\n seat_type=SeatType.ECONOMY,\n stops=MaxStops.NON_STOP,\n sort_by=SortBy.CHEAPEST,\n)\n\n# Search flights\nsearch = SearchFlights()\nflights = search.search(filters)\n\n# Process results\nfor flight in flights:\n print(f\"\ud83d\udcb0 Price: ${flight.price}\")\n print(f\"\u23f1\ufe0f Duration: {flight.duration} minutes\")\n print(f\"\u2708\ufe0f Stops: {flight.stops}\")\n\n for leg in flight.legs:\n print(f\"\\n\ud83d\udeeb Flight: {leg.airline.value} {leg.flight_number}\")\n print(f\"\ud83d\udccd From: {leg.departure_airport.value} at {leg.departure_datetime}\")\n print(f\"\ud83d\udccd To: {leg.arrival_airport.value} at {leg.arrival_datetime}\")\n```\n\n## Development\n\n```bash\n# Clone the repository\ngit clone https://github.com/punitarani/fli.git\ncd fli\n\n# Install dependencies with Poetry\npoetry install\n\n# Run tests\npoetry run pytest\n\n# Run linting\npoetry run ruff check .\npoetry run ruff format .\n\n# Build documentation\npoetry run mkdocs serve\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License \u2014 see the LICENSE file for details.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python wrapper for Google Flights API",
"version": "0.4.0",
"project_urls": {
"Documentation": "https://punitarani.github.io/fli",
"Homepage": "https://github.com/punitarani/fli",
"Repository": "https://github.com/punitarani/fli"
},
"split_keywords": [
"flights",
" google-flights",
" travel",
" api",
" flight-search"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a1caf410b2ff6dd0d7e0e7263643463b3f8d93b24add18e9a68423e9e8ef0189",
"md5": "1992bff2dc902aec12a1a23949458ccd",
"sha256": "c6ff93f847f4b87f138a95eaa378f3efae2f284508433332675bd5780c476f7f"
},
"downloads": -1,
"filename": "flights-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1992bff2dc902aec12a1a23949458ccd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 128191,
"upload_time": "2025-01-24T18:48:48",
"upload_time_iso_8601": "2025-01-24T18:48:48.499119Z",
"url": "https://files.pythonhosted.org/packages/a1/ca/f410b2ff6dd0d7e0e7263643463b3f8d93b24add18e9a68423e9e8ef0189/flights-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "50d3ab897f44991630a5d9e89da510e34e2aa63147cc8a16aa055df26cacd839",
"md5": "369434d1e1bb7ceeb59ae80983f1b33c",
"sha256": "dc9d2a0e8ecd082b0f1ee061845f5485cd54be9a95ca7a2feaeca8444812d553"
},
"downloads": -1,
"filename": "flights-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "369434d1e1bb7ceeb59ae80983f1b33c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 120678,
"upload_time": "2025-01-24T18:48:50",
"upload_time_iso_8601": "2025-01-24T18:48:50.837998Z",
"url": "https://files.pythonhosted.org/packages/50/d3/ab897f44991630a5d9e89da510e34e2aa63147cc8a16aa055df26cacd839/flights-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-24 18:48:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "punitarani",
"github_project": "fli",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "flights"
}