AWeirdDev / flights

Fast, robust Google Flights scraper (API) for Python. (Probably)
https://pypi.org/project/fast-flights
35 stars 9 forks source link

Unexpected date query behaviour #21

Open TijlJanssens opened 3 weeks ago

TijlJanssens commented 3 weeks ago

Hello and thank you for sharing your code!

I am trying to perform following query:

example.py --origin BRU --destination SGN --depart_date 2025-06-23 --return_date 2025-07-19 --max_stops 2 --inject_eu_cookies

But this one fails. (link that is returned is OK)

When I try

example.py --origin BRU --destination SGN --depart_date 2025-6-23 --return_date 2025-7-19 --max_stops 2 --inject_eu_cookies (so removing the 0 in front of the month in depart_date and return_date) weirdly enough the code passes but it gives results for 2025-03-28 to 2024-04-03

EDIT: When I change the destination to HAN, the first query does suddenly work.

dosubot[bot] commented 3 weeks ago

Hello @TijlJanssens! I'm here to help you with any coding issues or questions you may have. Let's dive in and see if we can solve this unexpected behavior together.

The code expects the date format to be "YYYY-MM-DD" for both depart_date and return_date parameters. The issue you're experiencing might be due to the incorrect date format when you remove the leading zero from the month. The correct format should always include the leading zero for single-digit months and days, like "2025-06-23" and "2025-07-19" [1][2].

Ensure that you use the "YYYY-MM-DD" format consistently to avoid unexpected behavior.

To continue talking to Dosu, mention @dosu.

TijlJanssens commented 3 weeks ago

I see, but when I use the correct format the code is throwing this error: RuntimeError: No flights found. (preflight checked) Possible reasons:

And when I am using a wrong format, the code is executed without error

houdie92 commented 6 days ago

Hi, unfortunately I experience the same issue. Any help please?