Overview
TheSearchDates class provides methods to search for flight prices across a date range, useful for finding the cheapest dates to fly. It uses Google Flights’ calendar view API to find the best prices for each date.
Class initialization
Methods
search
Search for flight prices across a date range and search parameters.Search parameters including date range, airports, and preferences
List of
DatePrice objects containing date and price pairs, or None if no results foundException: If the search fails or returns invalid data
- For date ranges larger than 61 days, the method automatically splits the search into multiple chunks
- Maximum search horizon is 305 days in the future
Return types
DatePrice
EachDatePrice object contains:
For one-way trips: single-element tuple with departure dateFor round-trip: two-element tuple with (departure date, return date)
Flight price for the specified date(s)
Constants
Maximum number of days that can be searched in a single API request. Larger date ranges are automatically split into multiple chunks.
Notes
- The search automatically handles large date ranges by splitting them into 61-day chunks
- Only dates with available pricing data are returned in the results
- The search client includes automatic rate limiting (10 req/sec) and retries
- For round-trip searches, the
durationparameter in filters controls the length of the trip