Skip to main content

Server-side Python SDK for the Idenplane admin API (OIDC discovery + user management)

Project description

Idenplane

idenplane

Official server-side Python SDK for Idenplane
OIDC discovery and admin user management against the Idenplane realm-management API.

v0.3.0 Python 3.9+ mypy strict MIT


Install

pip install idenplane

Requires Python 3.9 or newer. The only runtime dependency is requests.


Quick start

from idenplane import Client, Config

# Or: Config.from_env() — reads IDENPLANE_BASE_URL, IDENPLANE_REALM,
# IDENPLANE_ADMIN_TOKEN.
cfg = Config(
    base_url="https://auth.example.com",
    realm="my-realm",
    admin_token="eyJ...",  # service-account token with realm-management role
)

with Client(cfg) as client:
    # OIDC discovery (cached for 5 minutes by default)
    oidc = client.discovery.get()
    print(oidc["token_endpoint"])

    # Create a user
    user = client.users.create({
        "username": "alice",
        "email": "alice@example.com",
        "firstName": "Alice",
        "enabled": True,
    })
    print(user["id"])

User CRUD

from idenplane import Client, Config, ListUsersOptions

with Client(Config.from_env()) as client:
    # Read
    user = client.users.get("user-id-123")

    # List with filters and pagination (page is 1-based, limit defaults to 20)
    result = client.users.list(
        ListUsersOptions(page=1, limit=25, search="alice", enabled=True)
    )
    print(result["total"], "users")
    for u in result["users"]:
        print(u["username"])

    # Update
    user = client.users.update("user-id-123", {"email": "new@example.com"})

    # Reset password
    client.users.reset_password("user-id-123", "S3cret!", temporary=True)

    # Delete
    client.users.delete("user-id-123")

Errors

All SDK errors inherit from idenplane.IdenplaneError. HTTP responses are mapped to typed subclasses so callers can catch what they care about:

Status Exception
401/403 AuthError
404 NotFoundError
429 RateLimitError
5xx ServerError
other IdenplaneError
from idenplane import Client, Config
from idenplane.exceptions import NotFoundError

with Client(Config.from_env()) as client:
    try:
        client.users.get("does-not-exist")
    except NotFoundError as exc:
        print("not found:", exc.status_code, exc.body)

Discovery cache

DiscoveryCache is thread-safe and TTL-bounded (default 5 minutes). It is exposed via client.discovery.cache for tests and advanced use:

with Client(cfg) as client:
    client.discovery.get()              # network call
    client.discovery.get()              # cache hit
    client.discovery.invalidate()       # clear all realms
    client.discovery.refresh()          # forced refetch

Development

git clone https://github.com/idenplane/idenplane.git
cd idenplane/packages/idenplane-python
python3 -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest -v
mypy idenplane
ruff check .

License

MIT. See LICENSE.

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

idenplane-0.3.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

idenplane-0.3.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file idenplane-0.3.0.tar.gz.

File metadata

  • Download URL: idenplane-0.3.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for idenplane-0.3.0.tar.gz
Algorithm Hash digest
SHA256 589239399299592f298c9ecf479d79500d3492c5d99fbaf379a41fa98424fb6b
MD5 2e1fabe827f69373c9428f0758e9b043
BLAKE2b-256 8838efda07fdb97978e0a7c66a3b4c947e6dc6ec4a8ed776708c1547f2bc1dc9

See more details on using hashes here.

File details

Details for the file idenplane-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: idenplane-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for idenplane-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b04f5686d6fe32bf231131cd07466588477c30c20747ec3aeff3e0e26cbf66db
MD5 cd3a0acc19f11bce7b966d1a1a32d8ca
BLAKE2b-256 9d7c56226923b9d04dbfb5e4930edb6390b97bf2c4cae48fa79b8c7aa1943ada

See more details on using hashes here.

Supported by

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