Constructor options
Constructor arguments for SonnyLabsClient — api_key, base_url, api_version, timeout_s, max_retries, and the httpx transport injection point.
SonnyLabsClient takes one positional argument (api_key) and a small
set of keyword-only arguments for tuning. Only api_key is required;
everything else has a sensible default chosen for the SaaS endpoint.
import os
from sonnylabs import SonnyLabsClient
client = SonnyLabsClient(
api_key=os.environ["SONNY_API_KEY"],
base_url="https://sonny.internal.example.com", # self-hosted
max_retries=5,
timeout_s=30.0,
)Arguments
Prop
Type
The
transportargument is intended for tests — pass anhttpx.MockTransport(or your ownhttpx.BaseTransport) to drive requests through a fixture instead of the network. Production callers should leave it at its default (None).
SonnyLabsClient
The main sonnylabs client class — constructor, scan methods, identity and API-key endpoints, and the underlying httpx transport hook.
Exception classes
The typed exception hierarchy raised by SonnyLabsClient — SonnyLabsError plus per-namespace subclasses for auth, scope, validation, idempotency, rate-limit, not-found, and server errors.