Skip to main content

Config & auth

This article refers to SDK version v0.5.0. The current SDK version is N/A.

BarbaraConfig holds the credentials and connection settings BarbaraClient/AsyncBarbaraClient authenticate with — see Authenticate in the Getting started guide for how to build one. TokenManager and AsyncTokenManager are internal: the client creates one for you and refreshes tokens automatically, so most callers never touch them directly.

BarbaraConfig

client_secret and password are excluded from repr() — dataclasses print every field by default, and this object (or the client holding it, via client.config) can end up in a log line, a traceback, or a debugger without anyone intending to print a secret.

FieldType
client_idstr
client_secretOptional[str]
usernamestr
passwordstr
api_urlstr
auth_urlstr
realmstr
verify_tlsbool

TokenManager

TokenManager(config: BarbaraConfig, http_client: httpx.Client)

Sync token fetch/refresh. Not thread-safe by design (kept simple).

get_token

get_token(*, force_refresh: bool = False) -> str

AsyncTokenManager

AsyncTokenManager(config: BarbaraConfig, http_client: httpx.AsyncClient)

Async counterpart of TokenManager.

get_token

get_token(*, force_refresh: bool = False) -> str

Signatures and fields above are generated from barbara-api-sdk 0.5.0 docstrings. If a new SDK release changes one, this page needs a re-sync — the surrounding prose does not update itself.