Skip to main content

OpenBucket Python client

openbucket-client is the typed, dependency-free Python client for a running OpenBucket management API. It supports Python 3.10+ and uses only the standard library at runtime.

This package is a client, not a Python implementation of the OpenBucket daemon. Start the OpenBucket daemon separately, then point this client at its management URL. Object data is stored and served by that daemon.

Install

openbucket-client is not on PyPI yet. Install it from a checked-out OpenBucket repository:

python -m pip install ./python

After the first unified 0.1.1 release is visible on PyPI:

python -m pip install openbucket-client==0.1.1
pipx install openbucket-client==0.1.1
# or
uv tool install openbucket-client==0.1.1

The distribution is named openbucket-client; the import package is openbucket.

Python API

import os

from openbucket import OpenBucketClient

client = OpenBucketClient(
    os.environ.get("OPENBUCKET_API_URL", "http://127.0.0.1:7272"),
    os.environ["OPENBUCKET_ADMIN_TOKEN"],
)

print(client.status().storage.free_bytes)

bucket = client.create_bucket("project-assets")
uploaded = client.upload_file(
    bucket.name,
    "images/logo.svg",
    "logo.svg",
    content_type="image/svg+xml",
)
print(uploaded.etag)

share = client.create_share(bucket.name, uploaded.key, expires_in=3600)
print(share.url)

The client exposes immutable typed models and methods for:

  • daemon health, status, endpoints, and client configuration;
  • bucket creation, visibility, listing, and deletion;
  • object listing, streaming upload, download, metadata, and deletion;
  • S3 access-key creation, listing, and revocation;
  • expiring share URL creation;
  • request logs, analytics, and graceful daemon stop.

upload_file() streams from disk. download_to() streams to disk, uses an exclusive create by default, and can atomically replace a destination with overwrite=True. download_object() returns bytes and accepts max_bytes when the caller needs a memory safety bound.

Error handling

from openbucket import OpenBucketHTTPError

try:
    client.create_bucket("already-present")
except OpenBucketHTTPError as error:
    print(error.status)  # 409
    print(error.code)  # BucketAlreadyExists
    print(error.request_id)  # request correlation ID, when provided

Transport, protocol, configuration, and HTTP failures have separate exception types. The client does not follow redirects, preventing a management bearer token from being forwarded to another origin.

Command line

Set credentials in the environment so the token does not appear in shell history or the process list:

export OPENBUCKET_API_URL=http://127.0.0.1:7272
export OPENBUCKET_ADMIN_TOKEN='replace-with-the-daemon-token'

openbucket-client status
openbucket-client buckets list
openbucket-client buckets create project-assets
openbucket-client objects upload project-assets images/logo.svg ./logo.svg
openbucket-client objects download project-assets images/logo.svg ./downloaded.svg
openbucket-client share project-assets images/logo.svg --expires-in 3600
openbucket-client --json analytics

Use openbucket-client --help for the complete command tree. --token exists for automation environments that cannot inject variables, but the environment variable is safer for interactive use.

TLS and remote use

Use an HTTPS management URL for any connection that leaves localhost or a trusted private network. The bearer token grants full management access. Do not embed it in browser code, logs, container images, or source control. Python uses the platform/default CA trust store and honors the standard proxy environment variables.

Development and verification

The test suite performs real loopback HTTP requests against a threaded local HTTP server; it does not patch or mock urllib.

cd python
python -m unittest discover -s tests -v
python -m pip install -e '.[dev]'
ruff check .
mypy src/openbucket
python -m build
twine check dist/*
python -m pip install --force-reinstall dist/openbucket_client-0.1.1-py3-none-any.whl
openbucket-client --version

tox verifies the built wheel on every locally installed Python version from 3.10 through 3.14:

tox

Licensed under Apache-2.0. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openbucket_client-0.1.23.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openbucket_client-0.1.23-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file openbucket_client-0.1.23.tar.gz.

File metadata

  • Download URL: openbucket_client-0.1.23.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for openbucket_client-0.1.23.tar.gz
Algorithm Hash digest
SHA256 2f62263fc0856d4d04335ff52506e2a8f06a8d10912e8a25239118ad6e8c2e9e
MD5 1be34531de88b253348406a9cc58a3a0
BLAKE2b-256 a177e234bc36ee948a1df0be09de5b0ad36eaa5784b9c32a1c7cacbe4e264a8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for openbucket_client-0.1.23.tar.gz:

Publisher: release.yml on Razin-developer/openbucket

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openbucket_client-0.1.23-py3-none-any.whl.

File metadata

File hashes

Hashes for openbucket_client-0.1.23-py3-none-any.whl
Algorithm Hash digest
SHA256 45a0fd389ea5e4676836e2abc7eff6e362224f0a004ceb95145d6077d0249718
MD5 c98f095e98b975c975ef02b71a5f5cab
BLAKE2b-256 02396aa3417da196bad29e47e8952dde359382572989db437666e9a222fb29f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for openbucket_client-0.1.23-py3-none-any.whl:

Publisher: release.yml on Razin-developer/openbucket

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.31

2 files

0.1.28

2 files

0.1.27

2 files

0.1.26

2 files

0.1.25

2 files

0.1.24

2 files

This release

0.1.23 This release

2 files

0.1.22

2 files

0.1.21

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.16

2 files

0.1.14

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.5

2 files

0.1.3

2 files

0.1.1

2 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