v3.0-dev #72
Replies: 2 comments 8 replies
-
I think the previous version worked pretty well, but I understand the desire to refactor although breaking changes are always sad. A couple of thoughts -
I'm not sure what this bit is saying? The examples don't mention filter either
IMO something like |
Beta Was this translation helpful? Give feedback.
-
I may be missing something, but I'm not seeing any pricing information in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
See original
I must apologize to all the people here. The original code written by me was really bad, some don't even make sense, and I'd like to deeply apologize to all contributors who take their precious time to figure all that out. (In fact, I couldn't remember how things still work after a year.)Therefore in this update, I tried to rewrite it while keeping all the contributors' findings and suggestions.
Try it out
You can try things out in the
dev
branch.To preserve the previous version, I named it
fflights
.Changes
Here are the breaking changes.
Reworked source
The overall code structure has been updated. Instead of having a source file called
core.py
, which is a bit vague, I have split it into multiple files:fetcher.py
- For fetching.parser.py
- For parsing.querying.py
- For querying (see below on "Query API").Query API
Instead of calling it "filter" (as it overlaps with a Python utility), it's now being renamed "filter."
What's more, there are now three types of querying.
Structured
This is generally recommended, and it's pretty similar to the previous Filter API.
Str-based
Recommended by
@lookacat
(ping suppressed to not disturb anyone's peace).Tuple-based
This is not really recommended, but a shortened way to write queries if you're familiar with it.
Getting flights
Just like usual,
get_flights()
.Example result (truncated):
A few notes:
typ
, not a typo. Solely to avoid overlapping with Python'stype
.Js
because we're only using Javascript data as of now (see below on "Data source").fetch_flights()
, which returns astr
(the HTML).Data source
It's Javascript.
Long answer: Currently,
v3.0-dev
only uses Javascript as the data source, as it seems to be more reliable... until Google decides to obfuscate it.Minimum supported Python version
Bumped to Python 3.9+ as it requires several typing utilities and dataclasses.
That's it for this 'lil announcement. Let me know what you think (or what you hate about it, and I'll try to fix it ASAP).
Try the release candidate: https://pypi.org/project/fast-flights/3.0rc0/
Beta Was this translation helpful? Give feedback.
All reactions