Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: define API client wrapping grants flow #2

Closed
wants to merge 14 commits into from

Conversation

thekaveman
Copy link
Member

@thekaveman thekaveman commented Aug 23, 2023

Uses Authlib's OAuth2Session for requests

Tried Authlib at first, but they follow the OAuth2 spec to the letter, meaning POST bodies are sent as application/x-www-form-urlencoded while Littlepay's API requires appliction/json.

(There does not seem to be a way to change the body type in Authlib)

* devcontainer configuration
* stub out CLI app with sub-commands
* pytest for testing, run in CI
@github-actions
Copy link

github-actions bot commented Aug 23, 2023

Coverage report

The coverage rate went from 87.17% to 94.16% ⬆️
The branch rate is 89%.

88.63% of new lines are covered.

Diff Coverage details (click to unfold)

littlepay/config.py

16.66% of new lines are covered (92.85% of the complete file).
Missing lines: 154, 156, 157, 158, 160

littlepay/api/client.py

100% of new lines are covered (98% of the complete file).

@thekaveman thekaveman force-pushed the feat/config branch 2 times, most recently from 13f6a2f to c9d39a0 Compare August 24, 2023 07:22
optionally reuse an existing token
authlib sends a form-encoded body in POST with no way to override

Littlepay requires a JSON-encoded body, implement token refresh by hand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant