SDKs

Python SDK

tigby on PyPI – generated from the API's own contract, sync and async.

pip install tigby        # or: uv add tigby

Generated from the OpenAPI document, which is itself generated from the running API – the package cannot describe an endpoint the API does not have.

Use it

import os

from tigby import TigbyError, create_client
from tigby.api_client.api.identities import create_identity, list_identities
from tigby.api_client.models import CreateIdentityRequest

client = create_client(api_key=os.environ["TIGBY_API_KEY"])

created = create_identity.sync(client=client, body=CreateIdentityRequest(handle="orderbot"))
print(created.saga.status)  # provisioning has started

create_async_client gives the same client for the awaitable half of every operation (asyncio, asyncio_detailed). Both default to https://api.tigby.eu; pass base_url="http://localhost:8080" for a dev stack.

The key is optional, and the credential goes on per operation rather than onto every request. Eight operations take none, and one of them is how a key is obtained:

from tigby import create_client
from tigby.api_client.api.auth import poll_device_authorization, start_device_authorization
from tigby.api_client.models import DeviceTokenRequest, StartDeviceRequest

anonymous = create_client()

started = start_device_authorization.sync(client=anonymous, body=StartDeviceRequest(name="laptop", client="cli"))
print(started.user_code)  # confirm this in the console

issued = poll_device_authorization.sync(client=anonymous, body=DeviceTokenRequest(device_code=started.device_code))
print(issued.key)         # the Admin Key, shown once

Errors

Every refusal raises TigbyError – the RFC 9457 problem with its Tigby members:

try:
    create_identity.sync(client=client, body=CreateIdentityRequest(handle="orderbot"))
except TigbyError as error:
    error.code        # "handle_taken" – stable, branch on it
    error.agent_hint  # what to do instead
    error.doc_url     # where a human reads more

On this page