Round-trip searches
Round-trip searches require two flight segments and theROUND_TRIP trip type:
Processing round-trip results
Round-trip searches return tuples of(outbound_flight, return_flight):
Round-trip results include separate
FlightResult objects for outbound and return, making it easy to analyze each direction independently.Limiting return flight results
By default, Fli fetches return flights for the top 5 outbound flights. Adjust this with thetop_n parameter:
Multi-passenger bookings
Search for flights with multiple passengers using thePassengerInfo model:
Passenger types
adults- Passengers 18 years and olderchildren- Passengers 2-17 years oldinfants_on_lap- Infants under 2 years old sitting on a lap (no seat)infants_in_seat- Infants under 2 years old with their own seat
Pricing with multiple passengers
The returnedflight.price is the total price for all passengers:
Complete multi-passenger example
Complete multi-passenger example
Time restrictions
Control departure and arrival times for each flight segment:Time format
All times are in hours from midnight (0-23) in local airport time:0= midnight6= 6:00 AM12= noon18= 6:00 PM23= 11:00 PM
Different restrictions per segment
Apply different time restrictions to each segment of a round-trip:Time restrictions are per segment. For multi-leg flights, the restriction applies to the first leg’s departure and last leg’s arrival.
Date range searches
Find the cheapest dates to fly within a date range usingSearchDates:
Round-trip date searches
For round-trips, specify the trip duration:Filtering date results
Filter results by day of the week or other criteria:Layover control
Manage layover airports and durations:Layover preferences
Theairports parameter suggests preferred layover locations but doesn’t guarantee them:
The
max_duration applies to each individual layover, not the total layover time for multi-stop flights.Processing flight legs
EachFlightResult contains one or more FlightLeg objects:
Result analysis
Analyze search results to find patterns:Advanced analysis with pandas
Advanced analysis with pandas
Builder utilities
Use builder functions for common search patterns:The builder utilities automatically set the
trip_type based on whether a return_date is provided.