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",
path="uploads/photo.jpg",
visibility=Visibility.PUBLIC,
)
print(uploaded.id, uploaded.url)
Multipart Uploads
Large uploads automatically use multipart sessions when the API selects them. You can force multipart uploads and tune concurrency when you need resumable part recording:
from byteship import UploadMethod
with open("video.mp4", "rb") as video:
uploaded = client.upload(
video,
filename="video.mp4",
content_type="video/mp4",
path="uploads/video.mp4",
method=UploadMethod.MULTIPART,
multipart_concurrency=4,
)
Multipart uploads require a seekable file object so the SDK can upload part ranges independently.
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",
path="contracts/contract.pdf",
visibility=Visibility.PRIVATE,
)
signed_url = client.create_signed_url(
private_file.path,
expires_in_seconds=15 * 60,
)
print(signed_url.signed_url.url)
Image URLs
from byteship import image_srcset, image_url
src = image_url(uploaded.url, {"width": 800, "format": "webp"})
srcset = image_srcset(
uploaded.url,
widths=[320, 640, 960],
transform={"fit": "cover", "height": 400, "format": "webp"},
)
Features
uploadcreates an upload session, streams bytes to storage, and completes it, including multipart uploads when selected.upload_manyuploads batches with bounded concurrency.create_upload_tokenmints scoped browser upload tokens from trusted server code.create_file_upload,create_upload,create_upload_part_urls,complete_path_upload, andcomplete_uploadexpose the lower-level upload lifecycle.get_file,create_signed_url, anddelete_filecover file management and private delivery.image_urlandimage_srcsetbuild Byteshiptrtransform URLs for responsive images.ByteshipErrorexposes structured API errors withcode,status, anddetails.- No runtime dependencies; the SDK uses the Python standard library.
Metadata
Release files for byteship 0.1.5
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 |
|---|---|---|---|---|
| byteship-0.1.5.tar.gz | 13.8 kB | Without provenance | Details for byteship-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| byteship-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for byteship-0.1.5-py3-none-any.whl |
Total release size: 24.1 kB
Release files / byteship-0.1.5.tar.gz
| Download URL | byteship-0.1.5.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e88cbba99a058511a65ceca77567a8df24e6b4358af76dbebc25f04c36463c44
|
|
BLAKE2b-256 checksum How to use checksums |
5715df553c3340e4df8e878d5b4b9d99ea969431a5766ff07c192addb271ac87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / byteship-0.1.5-py3-none-any.whl
| Download URL | byteship-0.1.5-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2458c4f535b7d70c4ac7946d012a79cb576ea2f5994e79790ef34b63058c121
|
|
BLAKE2b-256 checksum How to use checksums |
de43443886213eb1000fdb05fb2cb74d79eb435c5a18b0a611446051d9da2576
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for byteship 0.1.5
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.