Python SDK

PyPI package tollara-service-sdk, import as tollara_service_sdk. Verify inbound gateway HMAC, validate service keys, usage pre-flight (service-key and JWT paths), gateway invoke, report usage, progress and completion, and poll async job status. Full contract and examples: SDK repo README (sdk-python).

Requirements

Python 3.10+

Install

pip install Tollara-service-sdk

For HTTP features (validate, usage, gateway, progress), install the extra:

pip install Tollara-service-sdk[http]

Contract E2E pins 0.0.1. Current releases: PyPI — Tollara-service-sdk.

Configuration

SettingDefaultNotes
API originhttps://api.tollara.aiTollaraClient.DEFAULT_API_URL; override with api_url=... or TOLLARA_API_URL
Service IDEnv / argumentTOLLARA_SERVICE_ID or service_id=... — optional if Core infers from the key
Service secretEnv / argumentTOLLARA_SERVICE_SECRET or service_secret=...required one way or the other

Constructor arguments override environment variables when both are set. Constants TollaraClient.ENV_API_URL, ENV_SERVICE_ID, ENV_SERVICE_SECRET mirror the env names. Progress and completion use the full progress_url / callback_url strings from the gateway.

Usage report: JSON body includes an ISO-8601 timestamp; X-Tollara-Timestamp is Unix epoch seconds for signing. For report_usage_at, pass timestamp as epoch seconds (or omit for “now”); values above 1e11 are treated as milliseconds.

Verification helpers

Preferred one-step verify + user context: verify_inbound_context (alias: verify_signature_from_headers_and_get_user_context). Inbound verification defaults to signing version v2.

See also