A typed Python client for the Busbar Admin API (/api/v1/admin).
The client is generated from the typed OpenAPI 3.1 schema in
openapi.json with
openapi-python-client,
so every response is a real dataclass (InfoView, TopologyInfo, ...) — not
Any/dict.
PyPI package name:
busbar-admin. (busbaris already taken on PyPI, so the admin SDK ships asbusbar-admin.)
The SDK carries its own semantic version, independent of the busbar server /
OpenAPI info.version (currently 1.4.0). This first cut is 0.1.0. A given
SDK release targets the frozen, additive-only /api/v1/admin surface and will
keep working across server versions on that surface.
pip install busbar-adminThe admin API authenticates with an x-admin-token header. Construct an
AuthenticatedClient that sends the token under that header name (no Bearer
prefix):
from busbar_admin import AuthenticatedClient
from busbar_admin.api.default import get_api_v1_admin_info
from busbar_admin.models import InfoView
client = AuthenticatedClient(
base_url="http://localhost:8081",
token="YOUR_ADMIN_TOKEN",
# send the credential as `x-admin-token: <token>` instead of Authorization: Bearer
auth_header_name="x-admin-token",
prefix="",
)
with client as client:
info: InfoView = get_api_v1_admin_info.sync(client=client)
# `info` is TYPED — your editor autocompletes .version, .topology, .build, ...
print("busbar version:", info.version) # -> "1.4.0"
print("pools:", info.topology.pools)
print("config version:", info.config_version)Prefer
Authorization: Bearer? Drop theauth_header_name/prefixoverrides — the defaultAuthenticatedClientsendsAuthorization: Bearer <token>, which the admin API also accepts.
Async is available too (get_api_v1_admin_info.asyncio / .asyncio_detailed).
The committed client is generated from openapi.json. To re-derive it:
make generate # pins openapi-python-client via requirements-dev.txtCI regenerates on every PR/push and fails if the committed client drifts from
openapi.json (git diff --exit-code).
Apache-2.0 © Busbar, Inc.