Skip to main content

Client for Keycloak Api (mostly users and impersonation)

Project description

Python Keycloak Client

Usage

Install

$ pip install python-keycloak-api-client

Example

from keycloak_api_client import KeycloakApiClient

client = KeycloakApiClient(
    keycloak_url: "https://auth.myservice.com",
    realm: "myservice",
    admin_username: "my_keycloak_admin",
    admin_password: "...",
    admin_client_id: "my_service_backend_client_id",
    admin_client_secret: "...",
    token_exchange_target_client_id: "my_service_backend_client_id",
)

read_kc_user = client.get_keycloak_user_by_email('johndoe@myservice.com')
read_kc_user.email      # johndoe@myservice.com
read_kc_user.enabled    # True
read_kc_user.first_name # John
read_kc_user.last_name  # Doe
...

Development

Test

# Runs tests for all Python versions and checks linter
$ tox

Linter

# Format
$ ruff format

# Check
$ ruff check

Install

$ pip install -e .

Changelog

CHANGELOG

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-keycloak-api-client-0.11.0.tar.gz (40.0 kB view hashes)

Uploaded Source

Built Distribution

python_keycloak_api_client-0.11.0-py2.py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page