Closed AlexanderOllman closed 2 months ago
Hi there,
The example code given is 2024-07-02
, a long time ago. Have you changed the value or parameters? If not, could you provide your code?
Thanks, AWeirdDev
I changed it to a newer date, and that is when it returned the error.
However, noting that some dates do work (e.g. 2024/08/02), but others such as 2024/11/02 do not, and result in the error.
E.g. this produces the error:
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-11-02", # Date of departure
from_airport="TPE",
to_airport="MYJ"
),
# ... 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=2,
children=1,
infants_in_seat=0,
infants_on_lap=0
),
)
# Get flights with a filter
result = get_flights(filter)
# The price is currently... low/typical/high
print("The price is currently", result.current_price)
Entering these airports and this date manually for one way returns a valid result.
Update: This configuration was not working prior to my original post, and is working now. I am unsure as to why.
However, what this code returns is a price=0.0. All results return price=0.0.
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-12-13", # Date of departure
from_airport="LAX",
to_airport="SYD"
),
FlightData(
date="2025-01-04", # Date of departure
from_airport="SYD",
to_airport="LAX"
),
# ... include more for round trips
],
trip="round-trip", # Trip (round-trip, one-way)
seat="economy", # Seat (economy, premium-economy, business or first)
passengers=Passengers(
adults=1,
children=0,
infants_in_seat=0,
infants_on_lap=0
),
)
# Get flights with a filter
result = get_flights(filter)
flight = result.flights[0]
# The price is currently... low/typical/high
print("The price is currently", result.current_price)
print(flight)
Result:
Flight(is_best=True, name='Delta', departure='10:25 PM on Fri, Dec 13', arrival='8:35 AM on Sun, Dec 15', arrival_time_ahead='+2', duration='15 hr 10 min', stops=0, delay=None, price=0.0)
Hey,
Have you tried taking a look at the web version of the page? That may help a lot!
Thanks
Steps Performed:
Output:
Attempted Fixes: