Python SDK
Connect
Section titled “Connect”In the Quickstart Python project, verify the account the SDK uses after CLI sign-in:
uv run python - <<'PY'from bsln.sdk import Client
with Client() as client: print(client.whoami()["name"])PYClient() reads the CLI connection settings. Pass Client(url, token) for an explicit connection. A with Client() block closes SDK-owned HTTP connections on exit. Close a borrowed http_client yourself. Supply either transport or http_client. The default timeout is 60 seconds per HTTP request phase.
Unsuccessful API responses raise BslnError with status_code, detail, and optional code and request_id. Use transport=httpx.MockTransport(handler) to test SDK calls with local responses.
Sessions and connections
Section titled “Sessions and connections”See sessions and state for controller ownership and lifecycle. Use streams to watch a session separately.
Account and stations
Section titled “Account and stations”client.whoami() needs read and gives the user ID, name and scopes. client.create_token(scopes, name=..., ttl_days=...) returns the value once and can only grant scopes you hold. Use client.tokens(limit=...) for one page or client.iter_tokens(page_size=...) for all metadata. client.revoke_token(token_id) revokes an owned token. Check client.robot_types() for station types and client.tasks() for built-in tasks and availability.
Collections and submission recovery
Section titled “Collections and submission recovery”Iterators fetch all pages. If a create response was lost, retry with the same request ID and unchanged arguments. For HTTP status, error fields and replay semantics, see requests and errors.
Station description
Section titled “Station description”Use session.description or the read-only client.session_description(session_id) to inspect a session’s robot configuration.
| Field | Value |
|---|---|
joint_order, joints |
Joint names in command order, with each joint’s unit, safe_range and max_velocity. |
cameras |
Camera names, dimensions and frame rates. |
poses, home_name |
Named positions supported by session.move_to. |
control_hz, deadman_timeout_s, chunks |
The advertised control rate, streamed-target lifetime, chunk size, horizon and playout delay. |