Skip to main content

Burrow SDK for Python

Read secrets from a self-hosted RatelKey Burrow with a machine identity.

  • Single and structured secrets, and individual fields of a structured secret.
  • The machine's own access map (list_projects, list_secrets).
  • Certificate pinning, or standard CA trust (TlsMode).
  • An OIDC token instead of a key (Burrow.oidc).

Requirements

  • Python 3.9+.
  • One dependency: cryptography (Ed25519 signing and the certificate pin).

Install

pip install ratelkey-burrow-sdk

Bootstrap a machine

From the Burrow dashboard, Machines → Add machine, and run the install it gives you on the target host. The identity lands at ~/.burrow/burrows/<slug>/identity.json.

Quick start

from ratelkey_burrow import Burrow

# The single machine identity on this host (under ~/.burrow, or $BURROW_HOME).
burrow = Burrow()

# A single-value secret:
api_key = burrow.get_secret("payments/prod/API_KEY").value

# A structured secret — one read, projected locally (no re-fetch):
db = burrow.get_secret("payments/prod/DATABASE")
everything = db.to_dict()                                  # every field as name -> value
host = db.get_field("host")                                # one field
user, password = db.get_fields("username", "password")     # in order

# What this machine can read:
for p in burrow.list_projects():
    print(p.project, p.categories)

Point it at a specific identity by selector or path:

Burrow("burrow-a1b2c3d4e5f60718")                            # slug / name / machine id / URL
Burrow("/home/you/.burrow/burrows/burrow-a1b2c3d4e5f60718")  # path (a burrow dir or identity.json)

Without ~/.burrow

For an app that manages its own key material:

import os
from ratelkey_burrow import Burrow

burrow = Burrow.connect(
    burrow_url="https://burrow.internal:12010",
    machine_id="...",
    private_key_pem=os.environ["BURROW_MACHINE_KEY"],  # PKCS#8 PEM
)

OIDC

import os
from ratelkey_burrow import Burrow

burrow = Burrow.oidc(
    burrow_url="https://burrow.example.com",
    fingerprint=os.environ.get("BURROW_FINGERPRINT"),  # omit for a publicly-trusted certificate
)

api_key = burrow.get_secret("payments/prod/API_KEY").value

audience defaults to burrow_url. GitHub Actions currently requires permissions: id-token: write.

Certificate trust

from ratelkey_burrow import Burrow, TlsMode

burrow = Burrow(tls=TlsMode.SystemTrust)

Without an explicit tls, the SDK uses the trust chosen when the machine was added: encrypted by default (works everywhere), or verified against the Burrow's own key or a CA if that was selected.

  • TlsMode.Pinned — trust-on-first-use, stored at ~/.burrow/burrows/<slug>/known_cert.
  • TlsMode.PinnedTo("aa:bb:...") — a fixed fingerprint (from the Burrow's network settings).
  • TlsMode.SystemTrust — CA + hostname verification, for a Burrow on a custom domain or Let's Encrypt.
  • TlsMode.Insecure — no verification; accepts any certificate. Opt-in only, for a network you already trust. Shortcut: Burrow().insecure_tls(True).

Errors

Every failure is a BurrowError: BurrowAuthError (401), BurrowForbiddenError (403, no grant), BurrowNotFoundError (404), BurrowServerError (5xx), BurrowCertificateError (pin mismatch), BurrowTransportError (unreachable / unparsable), BurrowIdentityError (no/ambiguous/invalid identity), plus two projection errors on the result handle — SecretShapeError (e.g. .value on a structured secret) and FieldNotFoundError. The message carries the Burrow's own reason.

Build

python -m build

Release files for ratelkey-burrow-sdk 1.0.2

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

Source distribution (sdist)

Source distribution for ratelkey-burrow-sdk 1.0.2
File Size Uploaded
ratelkey_burrow_sdk-1.0.2.tar.gz 21.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ratelkey-burrow-sdk 1.0.2
File Interpreter ABI Platform
ratelkey_burrow_sdk-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 47.9 kB

Release files / ratelkey_burrow_sdk-1.0.2.tar.gz

Download URL ratelkey_burrow_sdk-1.0.2.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
90fe4bb47508160f364e5aed4cf0997250cc866a6549bf67fcdef593775e2c45
BLAKE2b-256 checksum
How to use checksums
b5f8efc9eb58fff480f172407fb063f6403b3e5e9cc7911763ee25b7fe709e6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via ktor-client

Release files / ratelkey_burrow_sdk-1.0.2-py3-none-any.whl

Download URL ratelkey_burrow_sdk-1.0.2-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d75ba98f095a6f4dbf814bb8a5af9bff79ca74a178d5665c0df694231c109bf
BLAKE2b-256 checksum
How to use checksums
63cbf674f863a73123d47d74e1cea60d9798971192ce868e2f408b6ae4bc0aef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via ktor-client

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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