Models Reference¶
Core Models¶
FlightSearchFilters¶
The main model for configuring flight searches.
from fli.models import FlightSearchFilters, SeatType, MaxStops, SortBy
filters = FlightSearchFilters(
trip_type=TripType.ONE_WAY,
passenger_info=PassengerInfo(adults=1),
flight_segments=[...],
stops=MaxStops.NON_STOP,
seat_type=SeatType.ECONOMY,
sort_by=SortBy.CHEAPEST
)
fli.models.google_flights.FlightSearchFilters
¶
Bases: BaseModel
Complete set of filters for flight search.
This model matches required Google Flights' API structure.
airlines: list[Airline] | None = None
class-attribute
instance-attribute
¶
flight_segments: list[FlightSegment]
instance-attribute
¶
layover_restrictions: LayoverRestrictions | None = None
class-attribute
instance-attribute
¶
max_duration: PositiveInt | None = None
class-attribute
instance-attribute
¶
passenger_info: PassengerInfo
instance-attribute
¶
price_limit: PriceLimit | None = None
class-attribute
instance-attribute
¶
seat_type: SeatType = SeatType.ECONOMY
class-attribute
instance-attribute
¶
sort_by: SortBy = SortBy.NONE
class-attribute
instance-attribute
¶
stops: MaxStops = MaxStops.ANY
class-attribute
instance-attribute
¶
trip_type: TripType = TripType.ONE_WAY
class-attribute
instance-attribute
¶
encode() -> str
¶
URL encode the formatted filters for API request.
Source code in fli/models/google_flights.py
format() -> list
¶
Format filters into Google Flights API structure.
This method converts the FlightSearchFilters model into the specific nested list/dict structure required by Google Flights' API.
The output format matches Google Flights' internal API structure, with careful handling of nested arrays and proper serialization of enums and model objects.
RETURNS | DESCRIPTION |
---|---|
list
|
A formatted list structure ready for the Google Flights API request
TYPE:
|
Source code in fli/models/google_flights.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
FlightResult¶
Represents a flight search result with complete details.
fli.models.google_flights.FlightResult
¶
FlightLeg¶
Represents a single flight segment with airline and timing details.
fli.models.google_flights.FlightLeg
¶
Bases: BaseModel
A single flight leg (segment) with airline and timing details.
airline: Airline
instance-attribute
¶
arrival_airport: Airport
instance-attribute
¶
arrival_datetime: datetime
instance-attribute
¶
departure_airport: Airport
instance-attribute
¶
departure_datetime: datetime
instance-attribute
¶
duration: PositiveInt
instance-attribute
¶
flight_number: str
instance-attribute
¶
Enums¶
SeatType¶
Available cabin classes for flights.
fli.models.google_flights.SeatType
¶
MaxStops¶
Maximum number of stops allowed in flight search.
fli.models.google_flights.MaxStops
¶
SortBy¶
Available sorting options for flight results.
fli.models.google_flights.SortBy
¶
Bases: Enum
Available sorting options for flight results.
ARRIVAL_TIME = 4
class-attribute
instance-attribute
¶
CHEAPEST = 2
class-attribute
instance-attribute
¶
DEPARTURE_TIME = 3
class-attribute
instance-attribute
¶
DURATION = 5
class-attribute
instance-attribute
¶
NONE = 0
class-attribute
instance-attribute
¶
TOP_FLIGHTS = 1
class-attribute
instance-attribute
¶
Support Models¶
PassengerInfo¶
Configuration for passenger counts.
fli.models.google_flights.PassengerInfo
¶
Bases: BaseModel
Passenger configuration for flight search.
TimeRestrictions¶
Time constraints for flight departure and arrival.
fli.models.google_flights.TimeRestrictions
¶
Bases: BaseModel
Time constraints for flight departure and arrival in local time.
All times are in hours from midnight (e.g., 20 = 8:00 PM).
earliest_arrival: NonNegativeInt | None = None
class-attribute
instance-attribute
¶
earliest_departure: NonNegativeInt | None = None
class-attribute
instance-attribute
¶
latest_arrival: PositiveInt | None = None
class-attribute
instance-attribute
¶
latest_departure: PositiveInt | None = None
class-attribute
instance-attribute
¶
PriceLimit¶
Price constraints for flight search.