Skip to main content

Client for Keycloak Api (mostly users and impersonation)

Project description

Python Keycloak API client

PyPI version CircleCI

This library wraps the Keycloak REST API, providing an easy way to manage users, clients, and other Keycloak resources. It’s simple, extendable, and has been tested in production.

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: "...",
    relative_path: "/auth",
)

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

# Run linter and tests for all Python versions
$ 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.13.0.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

python_keycloak_api_client-0.13.0-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-keycloak-api-client-0.13.0.tar.gz.

File metadata

  • Download URL: python-keycloak-api-client-0.13.0.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.11.2 requests/2.32.3 setuptools/49.2.1 requests-toolbelt/1.0.0 tqdm/4.67.0 CPython/3.9.2

File hashes

Hashes for python-keycloak-api-client-0.13.0.tar.gz
Algorithm Hash digest
SHA256 1ec865f63c0fc6ae7454d2f5181d3d402fdd78b6d4761e93fd9453d439ad6851
MD5 bfbabc25513a44cef2201da46683ed57
BLAKE2b-256 7f939f1b199c2aa7fc988f23328350db5b8aa2c371d1d9b3e8707f9c67119baa

See more details on using hashes here.

File details

Details for the file python_keycloak_api_client-0.13.0-py2.py3-none-any.whl.

File metadata

  • Download URL: python_keycloak_api_client-0.13.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.11.2 requests/2.32.3 setuptools/49.2.1 requests-toolbelt/1.0.0 tqdm/4.67.0 CPython/3.9.2

File hashes

Hashes for python_keycloak_api_client-0.13.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6fc8eeb49c9162e60504e587137632b868159c676aa481e08bb79b09ed887aef
MD5 d93e8e56a92b69d0c5991665bbc981fc
BLAKE2b-256 ecb042750f4f10aa9c932ec60d0303f4e6afe3b4eb3c28f88ad6a2fb0d8658f6

See more details on using hashes here.

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