# Python Keycloak API client
[![PyPI version](https://badge.fury.io/py/python-keycloak-api-client.svg)](https://badge.fury.io/py/python-keycloak-api-client) [![CircleCI](https://dl.circleci.com/status-badge/img/gh/masterplandev/python-keycloak-api-client/tree/main.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/masterplandev/python-keycloak-api-client/tree/main)
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
```bash
$ pip install python-keycloak-api-client
```
### Example
```python
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
```bash
# Run linter and tests for all Python versions
$ tox
```
### Linter
```bash
# Format
$ ruff format
# Check
$ ruff check
```
### Install
```bash
$ pip install -e .
```
## Changelog
[CHANGELOG](CHANGELOG.md)
## License
[MIT](LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/masterplandev/python-keycloak-api-client",
"name": "python-keycloak-api-client",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "keycloak, client, api",
"author": "Szymon Marcinkowski",
"author_email": "szymon@masterhub.com",
"download_url": "https://files.pythonhosted.org/packages/a7/6c/53f84f39cd7c6e0ec14a83d9013ce8dc89a300fabac59c03b288c2607bce/python-keycloak-api-client-0.13.1.tar.gz",
"platform": null,
"description": "# Python Keycloak API client\n\n[![PyPI version](https://badge.fury.io/py/python-keycloak-api-client.svg)](https://badge.fury.io/py/python-keycloak-api-client) [![CircleCI](https://dl.circleci.com/status-badge/img/gh/masterplandev/python-keycloak-api-client/tree/main.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/masterplandev/python-keycloak-api-client/tree/main)\n\nThis library wraps the Keycloak REST API, providing an easy way to manage users, clients, and other Keycloak resources. It\u2019s simple, extendable, and has been tested in production.\n\n## Usage\n\n### Install\n\n```bash\n$ pip install python-keycloak-api-client\n```\n\n### Example\n\n```python\nfrom keycloak_api_client import KeycloakApiClient\n\nclient = KeycloakApiClient(\n keycloak_url: \"https://auth.myservice.com\",\n realm: \"myservice\",\n admin_username: \"my_keycloak_admin\",\n admin_password: \"...\",\n admin_client_id: \"my_service_backend_client_id\",\n admin_client_secret: \"...\",\n relative_path: \"/auth\",\n)\n\nread_kc_user = client.get_keycloak_user_by_email('johndoe@myservice.com')\nread_kc_user.email # johndoe@myservice.com\nread_kc_user.enabled # True\nread_kc_user.first_name # John\nread_kc_user.last_name # Doe\n...\n```\n\n## Development\n\n### Test\n\n```bash\n# Run linter and tests for all Python versions\n$ tox\n```\n\n### Linter\n\n```bash\n# Format\n$ ruff format\n\n# Check\n$ ruff check\n```\n\n### Install\n\n```bash\n$ pip install -e .\n```\n\n## Changelog\n\n[CHANGELOG](CHANGELOG.md)\n\n## License\n\n[MIT](LICENSE)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Client for Keycloak Api (mostly users and impersonation)",
"version": "0.13.1",
"project_urls": {
"Homepage": "https://github.com/masterplandev/python-keycloak-api-client"
},
"split_keywords": [
"keycloak",
" client",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "486a5b05e8a342d348712769e0a5550c2b3b3ef2d70a5140ea803b53835fceb6",
"md5": "8b2039039ec4f8e51d6146398098d36f",
"sha256": "beb30ad2e48ade8d6c95f73d008f4178059de09508cecf8809179a8adf53853d"
},
"downloads": -1,
"filename": "python_keycloak_api_client-0.13.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "8b2039039ec4f8e51d6146398098d36f",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 7976,
"upload_time": "2025-01-20T15:11:51",
"upload_time_iso_8601": "2025-01-20T15:11:51.960681Z",
"url": "https://files.pythonhosted.org/packages/48/6a/5b05e8a342d348712769e0a5550c2b3b3ef2d70a5140ea803b53835fceb6/python_keycloak_api_client-0.13.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a76c53f84f39cd7c6e0ec14a83d9013ce8dc89a300fabac59c03b288c2607bce",
"md5": "955da458bf70d96b8b1bcf8988c4fe22",
"sha256": "ae80c0b29d5c4ba1c5dd3bbaefd8842bad7a1b86b9ebcb2b6d43a59ecf5ef351"
},
"downloads": -1,
"filename": "python-keycloak-api-client-0.13.1.tar.gz",
"has_sig": false,
"md5_digest": "955da458bf70d96b8b1bcf8988c4fe22",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 40675,
"upload_time": "2025-01-20T15:11:52",
"upload_time_iso_8601": "2025-01-20T15:11:52.926798Z",
"url": "https://files.pythonhosted.org/packages/a7/6c/53f84f39cd7c6e0ec14a83d9013ce8dc89a300fabac59c03b288c2607bce/python-keycloak-api-client-0.13.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-20 15:11:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "masterplandev",
"github_project": "python-keycloak-api-client",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"circle": true,
"tox": true,
"lcname": "python-keycloak-api-client"
}