-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v3.0.0] - 2023.09.18 Added - Error handling for airport data loading. - Unit testing for main endpoints parsing, internal retryable queries w/ backoff, error handling and logging. Changed - Module console logging is now only set up if handlers haven't already been specified. - `dataclass` usage instead of `namedtuple`. - Only load airport data as needed. - Separated out concerns to `SessionManager`. - Less redundant logging. - Propagate up exceptions if all retries fail. Removed - **Removed the availability API.** - Unfortunately, grabbing a session cookie is now insufficient to use this API. Usage of the API now requires a session cookie to be generated within a "real" browser session. I do not wish to add the capability to specifically work around this, seemingly intentional, limitation. - With all this in mind, I've decided to regrettably remove the ability to use this endpoint from the library, since it will fail in most cases without such a workaround implemented. - Methods deprecated in v2.0.0 have now been completely removed.
- Loading branch information
Showing
14 changed files
with
1,040 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
pull_request: | ||
branches: [ "develop" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt -r requirements.dev.txt | ||
- name: Black | ||
run: black --check --verbose -- . | ||
- name: Run unit testing with pytest | ||
run: | | ||
pytest --cov --cov-report xml | ||
- name: Coveralls GitHub Action | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
path-to-lcov: coverage.xml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
black==23.3.0 | ||
pytest==7.4.0 | ||
pytest-cov==4.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
requests | ||
Deprecated | ||
backoff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import requests | ||
|
||
|
||
class SessionManager: | ||
BASE_SITE_FOR_SESSION_URL = "https://www.ryanair.com/ie/en" | ||
|
||
def __init__(self): | ||
self.session = requests.Session() | ||
self._update_session_cookie() | ||
|
||
def _update_session_cookie(self): | ||
# Visit main website to get session cookies | ||
self.session.get(self.BASE_SITE_FOR_SESSION_URL) | ||
|
||
def get_session(self): | ||
return self.session |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.