π Getting started#
To get started, install the package:
pip install mantelo
Now, assuming you have a Keycloak Server running, whatβs left is to:
authenticate to Keycloak, π Authenticating to Keycloak
make calls, see π‘ Making calls
For a quick test drive, use the
docker-compose.yml included in
the repo and start a Keycloak server locally using docker compose up. Open a Python REPL and
type:
from mantelo import KeycloakAdmin
# We assume the server is running on localhost:9090
# and the admin user is "admin" with password "admin"
c = KeycloakAdmin.from_username_password(
server_url="http://localhost:9090",
realm_name="master",
client_id="admin-cli",
username="admin",
password="admin",
)
# get the list of clients in realm "master"
c.clients.get()
# create a user
c.users.post({
"username": "test",
"enabled": True,
"credentials": [{"type": "password", "value": "test"}],
})
# get the user id
c.users.get(username="test")[0]["id"]
# ...