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.2.tar.gz (40.9 kB view details)

Uploaded Source

Built Distribution

python_keycloak_api_client-0.13.2-py2.py3-none-any.whl (8.1 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for python-keycloak-api-client-0.13.2.tar.gz
Algorithm Hash digest
SHA256 c0ca2217c11c8b172f4edb7a6a73f7161cc99e734b1f805d923ca70f6e73058c
MD5 85d3fcc9e9d790828ac3e969b8725bd4
BLAKE2b-256 bf6f5709a4133a6e105f56164591901c20fabaf5a982b6e8a15e2f31a97e1027

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for python_keycloak_api_client-0.13.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f1e754b725e7707b3374704e7c6c2f4905192e4821794f433d345c605923f439
MD5 1c28562e3e6cecfaea93d870b7426725
BLAKE2b-256 4a960e79484c60285302ecb9f830000d4221dcde838b7c9eeccd4a11fd31572f

See more details on using hashes here.

Supported by

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