Skip to main content

orion-belt-sdk

Python client for the Orion Belt API, for scripts and automation that glue Orion Belt into other tooling.

  • Covers every /api/v1 endpoint 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 are TypedDicts, 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

GNU Affero General Public License v3.0 only (AGPL-3.0-only). See LICENSE.

Metadata

Release files for orion-belt-sdk 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for orion-belt-sdk 1.1.0
File Size Uploaded Provenance Actions
orion_belt_sdk-1.1.0.tar.gz 35.3 kB Without provenance Details for orion_belt_sdk-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for orion-belt-sdk 1.1.0
File Interpreter ABI Platform Actions
orion_belt_sdk-1.1.0-py3-none-any.whl Python 3 none any Details for orion_belt_sdk-1.1.0-py3-none-any.whl

Total release size: 63.1 kB

Release files / orion_belt_sdk-1.1.0.tar.gz

Download URL orion_belt_sdk-1.1.0.tar.gz
Size 35.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1cc71921218d42dacfb897164e3c210f97d893b78691b8af89e61930de470839
BLAKE2b-256 checksum
How to use checksums
09deb843df6069823e8993eb2f6f0b05a3ba2e5053b705a82354eaf925e42ec0
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.1.0-py3-none-any.whl

Download URL orion_belt_sdk-1.1.0-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47e766c0105c722c2c219e7fc48878838a463bf3e928167be9f7f0243838df65
BLAKE2b-256 checksum
How to use checksums
2be66d72e914229e3684b74170e137c11a2820a0485d750e923dfb952a36fec6
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.1.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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page