Skip to content

Conversation

@davebelais
Copy link
Collaborator

This pull request updates the oapi library to version 2.8.6 and refactors error handling and request construction in OAuth2 authentication methods. The main improvements focus on simplifying control flow, improving exception handling, and ensuring more robust and readable code.

Version update:

  • Bumped the package version from 2.8.5 to 2.8.6 in pyproject.toml.

OAuth2 authentication refactoring:

  • Refactored _request_oauth2_password_authorization and _request_oauth2_client_credentials_authorization in src/oapi/client.py to construct the request object before the try block, improving readability and ensuring the request is always constructed regardless of exceptions. [1] [2] [3] [4]
  • Improved error handling in _get_oauth2_token_url by appending exception text for all errors and re-raising the original exception, rather than raising a new TimeoutError only for timeout conditions. This provides more accurate error reporting and preserves the original exception context.

@davebelais davebelais merged commit 20006e0 into main Jan 22, 2026
13 checks passed
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.

2 participants