Skip to content

Cd/add password grant support#33

Draft
chrisdoehring wants to merge 4 commits intov2from
cd/add-password-grant-support
Draft

Cd/add password grant support#33
chrisdoehring wants to merge 4 commits intov2from
cd/add-password-grant-support

Conversation

@chrisdoehring
Copy link
Copy Markdown
Collaborator

This pull request introduces significant improvements and new features to the Gundi async Python client, focusing on enhanced authentication flexibility, improved error handling, and better documentation. The update also modernizes the packaging configuration and maintains backward compatibility for existing users.

Key highlights:

  • Adds support for OAuth password grant authentication, allowing developers to use username/password credentials.
  • Introduces structured error handling with custom exceptions for authentication and API errors.
  • Updates the documentation for clarity, richer examples, and configuration guidance.
  • Refactors environment variable and keyword argument handling for authentication, supporting both new (OAUTH_*) and legacy (KEYCLOAK_*) names.
  • Migrates packaging to the PEP 621 standard (pyproject.toml), with dynamic versioning.

Authentication Improvements

  • Added support for OAuth password grant authentication, enabling the use of username/password credentials in addition to client credentials. Backward compatibility with legacy KEYCLOAK_* variables and arguments is preserved. (gundi_client_v2/auth.py [1] gundi_client_v2/client.py [2] [3] gundi_client_v2/settings.py [4]
  • Updated environment variable and constructor keyword argument handling to prefer OAUTH_* names, with fallbacks to KEYCLOAK_* for seamless migration. (gundi_client_v2/settings.py [1] gundi_client_v2/client.py [2]

Error Handling and Exceptions

  • Introduced custom exceptions: GundiClientError, AuthenticationError, and GundiAPIError for more granular error handling and clearer failure modes. (gundi_client_v2/errors.py [1] gundi_client_v2/__init__.py [2]
  • Refactored internal and public API methods to raise these custom exceptions on authentication or API errors, replacing generic or unhandled exceptions. (gundi_client_v2/client.py [1] [2] [3] [4]

Documentation and Usage Examples

  • Completely rewrote and expanded README.md with improved introduction, quick start, end-to-end examples, configuration, authentication modes, error handling, and usage for both GundiClient and GundiDataSenderClient. (README.md README.mdL1-R245)

Packaging and Versioning

  • Migrated packaging from Poetry to PEP 621-compliant pyproject.toml using Hatchling, with dynamic versioning sourced from the codebase. (pyproject.toml [1] gundi_client_v2/__init__.py [2]

Minor Fixes and Maintenance

  • Updated test fixture to match new status field format for integration details. (tests/conftest.py tests/conftest.pyL83-R83)

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