Skip to main content

The fast, robust, strongly-typed Google Flights scraper (API) implemented in Python.

Project description

flights

The fast, robust, strongly-typed Google Flights scraper (API) implemented in Python. Based on Baes64-encoded Protobuf string.

$ pip install fast-flights

Usage

To use fast-flights, you'll first create a filter (inherited from ?tfs=) to perform a request. Then, add flight_data, trip, seat and passengers info to use the API directly.

Honorable mention: I like birds. Yes, I like birds.

from fast_flights import FlightData, Passengers, create_filter, get_flights

# Create a new filter
filter = create_filter(
    flight_data=[
        # Include more if it's not a one-way trip
        FlightData(
            date="2024-07-02", 
            from_airport="TPE", 
            to_airport="MYJ"
        )
    ],
    trip="one-way",
    seat="economy",
    passengers=Passengers(
        adults=2,
        children=1
    ),
)

# Get flights from a filter
result = get_flights(filter)

# The price is currently... low/typical/high
print("The price is currently", result.current_price)

# Display the first flight
print(result.flights[0])

Additionally, you can use the Airport enum to search for airports in code (as you type)!

Airport.TAIPEI
              |---------------------------------|
              | TAIPEI_SONGSHAN_AIRPORT         |
              | TAPACHULA_INTERNATIONAL_AIRPORT |
              | TAMPA_INTERNATIONAL_AIRPORT     |
              | ... 5 more                      |
              |---------------------------------|

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_flights-0.1.tar.gz (42.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page