forked from AWeirdDev/flights
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_jsdata.py
More file actions
executable file
·35 lines (32 loc) · 938 Bytes
/
test_jsdata.py
File metadata and controls
executable file
·35 lines (32 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from fast_flights import FlightData, Passengers, create_filter, get_flights_from_filter
# Create a new filter
filter = create_filter(
flight_data=[
# Include more if it's not a one-way trip
FlightData(
date="2025-10-04", # Date of departure
from_airport="SJC",
to_airport="LAS"
),
# ... include more for round trips
],
trip="one-way", # Trip (round-trip, one-way)
seat="economy", # Seat (economy, premium-economy, business or first)
passengers=Passengers(
adults=1,
children=1,
infants_in_seat=0,
infants_on_lap=0
),
)
# Get flights with a filter
result = get_flights_from_filter(filter, data_source='js')
if result is not None:
print('Best:')
for flight in result.best:
print(flight)
print()
print('Others:')
for flight in result.other:
print(flight)
print()