Metadata-Version: 2.4
Name: byteship
Version: 0.1.3
Summary: Python client for the Byteship file upload API.
Project-URL: Homepage, https://byteship.cloud
Project-URL: Repository, https://github.com/byteshipcloud/byteship-python
Author: Byteship
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# Byteship Python SDK

Python client for the Byteship upload API.

```python
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:

```python
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,
    )
```

## Browser Upload Tokens

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

print(token.upload_token.token)
```

## Private Files

```python
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)
```

## Features

- `upload` creates an upload session, streams bytes to storage, and completes it, including multipart uploads when selected.
- `upload_many` uploads batches with bounded concurrency.
- `create_upload_token` mints scoped browser upload tokens from trusted server code.
- `create_file_upload`, `create_upload`, `create_upload_part_urls`, `complete_path_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.
