orion-belt-sdk
Python client for the Orion Belt API, for scripts and automation that glue Orion Belt into other tooling.
- Covers every
/api/v1endpoint the server exposes. A test checks the client against the server's route table, so new endpoints can't be missed. - Standard library only: no runtime dependencies.
- Typed (
py.typed): responses areTypedDicts, so fields the server adds in later versions still reach you. - Python 3.11+.
Install
pip install orion-belt-sdk
Use
from orion_belt_sdk import OrionBeltClient, OrionBeltError
client = OrionBeltClient("https://pam.example.com", api_key="...")
for machine in client.list_machines():
print(machine["name"], machine["is_active"])
request = client.create_access_request(
{"machine_id": machine["id"], "reason": "deploy 1.4.2", "duration": 3600, "remote_users": ["deploy"]}
)
try:
client.get_machine("does-not-exist")
except OrionBeltError as err:
print(err.status_code, err.message)
Method names follow the Go SDK
in snake_case (ListMachines becomes list_machines). For an endpoint the
client has no method for yet, use client.request(method, path, body).
Authentication
Pass one of api_key, session_token or bearer_token, or log in. The login
helpers store the credential they get back on the client.
| Helper | Credential |
|---|---|
login_with_ssh_key(username, signer) |
API key |
login_with_ssh_session(username, signer) |
session token (+ JWT) |
login_with_ssh_jwt(username, signer) |
JWT bearer token |
login_with_password(username, password, totp_code) |
session token (+ JWT) |
A signer proves you hold an SSH key registered to the user. It needs a
public_key (the authorized_keys line) and a sign(data) method that returns
the signature format and the raw signature. With the cryptography package:
from cryptography.hazmat.primitives import serialization
from orion_belt_sdk import OrionBeltClient
key = serialization.load_ssh_private_key(open("id_ed25519", "rb").read(), password=None)
class Signer:
public_key = key.public_key().public_bytes(serialization.Encoding.OpenSSH, serialization.PublicFormat.OpenSSH).decode()
def sign(self, data: bytes) -> tuple[str, bytes]:
return "ssh-ed25519", key.sign(data)
client = OrionBeltClient("https://pam.example.com")
client.login_with_ssh_key("alice", Signer())
For RSA keys, return "rsa-sha2-256" and a PKCS#1 v1.5 SHA-256 signature.
logout() ends the HTTP session and clears the session and bearer tokens from
the client. The server does not revoke a JWT at logout; it stays valid until
it expires.
WebSockets
terminal_ws_url() and session_watch_ws_url() return the ws:///wss://
URL. Open it with any WebSocket library and send client.auth_headers() with
the upgrade request.
Develop
From sdk/python, with uv:
uv sync --locked
uv run ruff check && uv run ruff format --check
uv run mypy
uv run pytest # includes branch coverage, fails under 90%
If the server adds an endpoint, regenerate the route list
(go test ./pkg/api -run TestRoutesManifest -update-routes from the repo root).
Then add the method and its entry in tests/test_contract.py.
Release
Bump version in pyproject.toml and push a tag sdk-python-v<version>. The
SDK release workflow tests, builds and publishes to PyPI.
License
Apache License 2.0 with the Commons Clause condition. See LICENSE.
Metadata
Release files for orion-belt-sdk 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| orion_belt_sdk-1.0.0.tar.gz | 27.4 kB | Without provenance | Details for orion_belt_sdk-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| orion_belt_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for orion_belt_sdk-1.0.0-py3-none-any.whl |
Total release size: 47.4 kB
Release files / orion_belt_sdk-1.0.0.tar.gz
| Download URL | orion_belt_sdk-1.0.0.tar.gz |
|---|---|
| Size | 27.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d97ce51eafcd2754908385756bda6079789f3d6f533d5ddaccf71f482c5e711
|
|
BLAKE2b-256 checksum How to use checksums |
2b1976d311fde290b5017e693652acacea8ade2eac01843857008725dc78ff1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / orion_belt_sdk-1.0.0-py3-none-any.whl
| Download URL | orion_belt_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54e23f1716caf3fabfdef78c2eb3cdf91039431d5cf8da7725f4cb9e6fb3e23c
|
|
BLAKE2b-256 checksum How to use checksums |
edf1f316ff09f1b2b3aa1c5efb11f234a5bc0525d330675577f86b20b4002a54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for orion-belt-sdk 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.