Skip to main content

Python client for the Byteship file upload API.

Project description

Byteship Python SDK

Python client for the Byteship upload API.

import os
from byteship import ByteshipClient, Visibility

client = ByteshipClient(api_key=os.environ["BYTESHIP_API_KEY"])

with open("photo.jpg", "rb") as photo:
    uploaded = client.upload(
        photo,
        filename="photo.jpg",
        content_type="image/jpeg",
        folder="uploads",
        visibility=Visibility.PUBLIC,
    )

print(uploaded.id, uploaded.url)

Browser Upload Tokens

token = client.create_upload_token(
    folder="avatars",
    visibility=Visibility.PUBLIC,
    max_upload_bytes=10 * 1024 * 1024,
)

print(token.upload_token.token)

Private Files

with open("contract.pdf", "rb") as document:
    private_file = client.upload(
        document,
        filename="contract.pdf",
        content_type="application/pdf",
        folder="contracts",
        visibility=Visibility.PRIVATE,
    )

signed_url = client.create_signed_url(
    private_file.id,
    expires_in_seconds=15 * 60,
)

print(signed_url.signed_url.url)

Features

  • upload creates an upload session, streams bytes to storage, and completes it.
  • upload_many uploads batches with bounded concurrency.
  • create_upload_token mints scoped browser upload tokens from trusted server code.
  • create_upload and complete_upload expose the lower-level upload lifecycle.
  • get_file, create_signed_url, and delete_file cover file management and private delivery.
  • ByteshipError exposes structured API errors with code, status, and details.
  • No runtime dependencies; the SDK uses the Python standard library.

Project details


Download files

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

Source Distribution

byteship-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

byteship-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file byteship-0.1.0.tar.gz.

File metadata

  • Download URL: byteship-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for byteship-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c9fef7032cb3a9912295d91fe8d962eb7dc9c120069d792c1cde3bddd511a58
MD5 699b91a25d6a80f1beecd7e21fd22b66
BLAKE2b-256 2dc75e8329f233f4c1403f3084f5fdd06e2481fd129f00b9309401e3880d9b8c

See more details on using hashes here.

File details

Details for the file byteship-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: byteship-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for byteship-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fed579d068d1c4faad9bf87632815ee898d00e5ac6fbf98c36e94921a3cadf64
MD5 1b726ede6f12cf8defac1b55bd7e40d8
BLAKE2b-256 352b9c677b4180eb35938537c0affa87c181da1b164e13c27df3a58306b1a326

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page