# 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

## Quick Start
```bash
pip install fli
```
```bash
# Install using pipx (recommended for CLI)
pipx install fli
# 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` |
## MCP Server Integration
Fli includes a Model Context Protocol (MCP) server that allows AI assistants like Claude to search for flights directly. This enables natural language flight search through conversation.
### Running the MCP Server
```bash
# Run the MCP server on STDIO
fli-mcp
# Or with uv (for development)
uv run fli-mcp
# Or with make (for development)
make mcp
```
### Claude Desktop Configuration
To use the flight search capabilities in Claude Desktop, add this configuration to your `claude_desktop_config.json`:
**Location**: `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
```json
{
"mcpServers": {
"flight-search": {
"command": "fli-mcp",
"args": []
}
}
}
```
After adding this configuration:
1. Restart Claude Desktop
2. You can now ask Claude to search for flights naturally:
- "Find flights from JFK to LAX on December 25th"
- "What are the cheapest dates to fly from NYC to London in January?"
- "Search for business class flights from SFO to NRT with no stops"
### MCP Tools Available
The MCP server provides two main tools:
- **`search_flights`**: Search for specific flights with detailed filters
- **`search_cheap_flights`**: Find the cheapest dates across a flexible date range
## 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 uv
uv sync --all-extras
# Run tests
uv run pytest
# Run linting
uv run ruff check .
uv run ruff format .
# Build documentation
uv run mkdocs serve
# Or use the Makefile for common tasks
make install-all # Install all dependencies
make test # Run tests
make lint # Check code style
make format # Format code
```
## 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": ">=3.12",
"maintainer_email": null,
"keywords": "api, flight-search, flights, google-flights, travel",
"author": null,
"author_email": "Punit Arani <punit@joinslash.com>",
"download_url": "https://files.pythonhosted.org/packages/11/99/52f64abc7c307edeea93d95f1f59c237fb74bd6294087a7238bd2b0b3c23/flights-0.5.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\n\n## Quick Start\n\n```bash\npip install fli\n```\n\n```bash\n# Install using pipx (recommended for CLI)\npipx install fli\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## MCP Server Integration\n\nFli includes a Model Context Protocol (MCP) server that allows AI assistants like Claude to search for flights directly. This enables natural language flight search through conversation.\n\n### Running the MCP Server\n\n```bash\n# Run the MCP server on STDIO\nfli-mcp\n\n# Or with uv (for development)\nuv run fli-mcp\n\n# Or with make (for development)\nmake mcp\n```\n\n### Claude Desktop Configuration\n\nTo use the flight search capabilities in Claude Desktop, add this configuration to your `claude_desktop_config.json`:\n\n**Location**: `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)\n\n```json\n{\n \"mcpServers\": {\n \"flight-search\": {\n \"command\": \"fli-mcp\",\n \"args\": []\n }\n }\n}\n```\n\nAfter adding this configuration:\n1. Restart Claude Desktop\n2. You can now ask Claude to search for flights naturally:\n - \"Find flights from JFK to LAX on December 25th\"\n - \"What are the cheapest dates to fly from NYC to London in January?\"\n - \"Search for business class flights from SFO to NRT with no stops\"\n\n### MCP Tools Available\n\nThe MCP server provides two main tools:\n\n- **`search_flights`**: Search for specific flights with detailed filters\n- **`search_cheap_flights`**: Find the cheapest dates across a flexible date range\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 uv\nuv sync --all-extras\n\n# Run tests\nuv run pytest\n\n# Run linting\nuv run ruff check .\nuv run ruff format .\n\n# Build documentation\nuv run mkdocs serve\n\n# Or use the Makefile for common tasks\nmake install-all # Install all dependencies\nmake test # Run tests\nmake lint # Check code style\nmake format # Format code\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",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python wrapper for Google Flights API",
"version": "0.5.0",
"project_urls": {
"Documentation": "https://punitarani.github.io/fli",
"Homepage": "https://github.com/punitarani/fli",
"Repository": "https://github.com/punitarani/fli"
},
"split_keywords": [
"api",
" flight-search",
" flights",
" google-flights",
" travel"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "511cb8812e9d688ce1fcf9db734c9b254cadbd66965449e27b3a725c1c6d7523",
"md5": "aff3f907d4f31d4f05a01c1a37ee75d2",
"sha256": "a2e30d1deb5f651bf8fe94536c3f026737cb08623ac3f494fc4a3724fc7e0dd2"
},
"downloads": -1,
"filename": "flights-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aff3f907d4f31d4f05a01c1a37ee75d2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 132571,
"upload_time": "2025-08-12T17:08:19",
"upload_time_iso_8601": "2025-08-12T17:08:19.551505Z",
"url": "https://files.pythonhosted.org/packages/51/1c/b8812e9d688ce1fcf9db734c9b254cadbd66965449e27b3a725c1c6d7523/flights-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "119952f64abc7c307edeea93d95f1f59c237fb74bd6294087a7238bd2b0b3c23",
"md5": "29ae4e2fdecfbf83a9021c4be3f20588",
"sha256": "b819ae5021ec25d3021ebd64d5bf46f0fd08f11db51c4b4d455d95be2ed8901e"
},
"downloads": -1,
"filename": "flights-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "29ae4e2fdecfbf83a9021c4be3f20588",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 1035112,
"upload_time": "2025-08-12T17:08:21",
"upload_time_iso_8601": "2025-08-12T17:08:21.138227Z",
"url": "https://files.pythonhosted.org/packages/11/99/52f64abc7c307edeea93d95f1f59c237fb74bd6294087a7238bd2b0b3c23/flights-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-12 17:08:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "punitarani",
"github_project": "fli",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "flights"
}