Get the FREE Ultimate OpenClaw Setup Guide →

find flights

npx machina-cli add skill rymc/find-flights/find-flights --openclaw
Files (1)
SKILL.md
4.4 KB

Find Flights

Quick Start

Agent setup rule:

  • If uv exists (command -v uv succeeds), use uv commands.
  • If uv is unavailable, fall back to python3 -m venv + pip.

Preferred path (uv available):

uv run --with "fast-flights[local]" playwright install chromium
uv run --with "fast-flights[local]" python scripts/search_airports.py "Portland"
uv run --with "fast-flights[local]" python scripts/search_flights.py --from PDX --to LAX --date 2026-03-10 --fetch-mode local

Fallback path (uv unavailable):

python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install "fast-flights[local]"
playwright install chromium
python3 scripts/search_airports.py "Portland"
python3 scripts/search_flights.py --from PDX --to LAX --date 2026-03-10 --fetch-mode local

Fallback note: if python3 -m venv fails with ensurepip is not available, install the system venv package first (for example on Ubuntu/Debian: sudo apt install python3-venv) or install fast-flights[local] into the active Python environment.

Search airports (returns enum matches and IATA codes):

uv run --with "fast-flights[local]" python scripts/search_airports.py "Portland"
uv run --with "fast-flights[local]" python scripts/search_airports.py "Berlin"

Search flights:

# One-way
uv run --with "fast-flights[local]" python scripts/search_flights.py --from PDX --to LAX --date 2026-03-10 --seat economy --adults 1 --fetch-mode local

# Round-trip (return leg is auto-added as TO -> FROM)
uv run --with "fast-flights[local]" python scripts/search_flights.py --from PDX --to LAX --date 2026-03-10 --return-date 2026-03-17 --max-stops 0 --fetch-mode local

Troubleshooting

If Google Flights blocks the request or returns no results, retry with:

uv run --with "fast-flights[local]" python scripts/search_flights.py ... --fetch-mode local
uv run --with fast-flights python scripts/search_flights.py ... --fetch-mode fallback
uv run --with fast-flights python scripts/search_flights.py ... --data-source js

Notes:

  • --data-source js and --airlines ... may be ignored depending on the installed fast-flights version.
  • If you see a Google consent page (e.g., "Before you continue to Google"), prefer --fetch-mode local.
  • --fetch-mode fallback may rely on a hosted Playwright service in some environments; if it fails, use --fetch-mode local.

Recommended local Playwright setup with uv:

uv run --with "fast-flights[local]" playwright install chromium
uv run --with "fast-flights[local]" python scripts/search_flights.py ... --fetch-mode local

Alternative with pip/venv:

python3 -m pip install "fast-flights[local]"
playwright install chromium
python3 scripts/search_flights.py ... --fetch-mode local

References

  • See references/fast_flights_api.md for the underlying API and fetch-mode notes.

Runtime lessons learned

  • For first run, uv run --with "fast-flights[local]" ... --fetch-mode local is the most reliable path and avoids global installs.
  • Start with --fetch-mode local when the environment has Playwright installed. The common and fallback modes can fail with consent screens or upstream timeouts.
  • Some installs throw No module named 'playwright' if fast-flights[local] is not installed.
  • The same route/date can return duplicates or malformed rows (price: 0, stops: Unknown), so use post-filters to keep only valid positive prices.
  • --airlines and --data-source are version-dependent; keep these as optional inputs and fall back cleanly when unsupported.
  • Use one-way legs when you need custom constraints (time-window filtering, minimum layover/ground-time, route shape), then combine legs manually to enforce exact rules.
  • Airport-name lookups can be ambiguous. Run search_airports.py first and pick the exact IATA code you want before searching flights.

Output formatting preference

  • Always include the day of week when reporting dates (example: Sat, Feb 21, Mon, Feb 23) so dates remain explicit.

Source

git clone https://github.com/rymc/find-flights/blob/main/SKILL.mdView on GitHub

Overview

Find flights using the fast-flights Python library (AWeirdDev/flights), a typed Google Flights scraper. It supports one-way, round-trip, and multi-city searches, with filters for cabin class, passengers, max stops, and airlines, plus airport code lookups and fetch-mode troubleshooting for consent/bot blocking.

How This Skill Works

The skill queries Google Flights through the fast-flights API wrapper to fetch flight options and airport codes. It supports fetch modes common, fallback, and local to handle consent screens, and you can filter results by date, cabin, passengers, max stops, and airlines; you can also list airport codes before running flight searches.

When to Use It

  • You need a one-way flight from a specific origin to a destination on a given date.
  • You need a round-trip flight with a return date and optional max stops.
  • You need a multi-city itinerary with several legs.
  • You want to list or search airport codes (IATA) for a city.
  • You are troubleshooting Google Flights blocks or consent pages and fetch-mode failures.

Quick Start

  1. Step 1: Ensure uv is installed and run the Playwright setup if you plan to use local fetch mode.
  2. Step 2: Run a simple airport lookup, e.g., scripts/search_airports.py "Portland" to confirm IATA codes.
  3. Step 3: Run a basic flight search, e.g., scripts/search_flights.py --from PDX --to LAX --date 2026-03-10 --seat economy --adults 1 --fetch-mode local

Best Practices

  • Start with fetch-mode local for reliability, especially if Playwright is already installed in your environment.
  • Use search_airports first to confirm airport codes before querying flights.
  • Apply post-filters to remove duplicates and results with price or data anomalies (e.g., price: 0, unknown stops).
  • Remember that --airlines and --data-source options are version-dependent; keep them optional.
  • If blocked by Google, retry with --fetch-mode local, then with --fetch-mode fallback or --data-source js as needed.

Example Use Cases

  • uv run --with "fast-flights[local]" python scripts/search_airports.py "Portland"
  • uv run --with "fast-flights[local]" python scripts/search_flights.py --from PDX --to LAX --date 2026-03-10 --seat economy --adults 1 --fetch-mode local
  • uv run --with "fast-flights[local]" python scripts/search_flights.py --from PDX --to LAX --date 2026-03-10 --return-date 2026-03-17 --max-stops 0 --fetch-mode local
  • If blocked by Google, retry with: uv run --with "fast-flights[local]" python scripts/search_flights.py ... --fetch-mode local
  • Note that duplicates or price: 0 can appear; apply post-filters to keep valid results.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers