reupload-sdk
Official server-side Python SDK for the Reupload public API.
- Typed API aligned with
@reupload/sdk(Node.js) - Sync (
Reupload) and async (AsyncReupload) clients via httpx - CDN upload flow (session → PUT → complete) and server direct multipart upload
- Optional FastAPI route helpers
Install
pip install reupload-sdk
# FastAPI helpers
pip install "reupload-sdk[fastapi]"
Requires Python 3.10+.
Quick start
from reupload import create_reupload_from_env
client = create_reupload_from_env()
me = client.whoami()
print(me["projects"])
Environment variables
| Variable | Required | Description |
|---|---|---|
REUPLOAD_API_KEY |
Yes | API key (ru_…) |
REUPLOAD_PROJECT_ID |
Yes | Default project UUID |
REUPLOAD_API_BASE_URL |
No | Default https://api.reupload.dev/api/v1 |
Manual client
from reupload import Reupload
client = Reupload(
api_key="ru_…",
default_project_id="your-project-uuid",
)
API overview
| Method | Description |
|---|---|
client.whoami() |
Verify key and list projects |
client.uploads.create_session() |
Start CDN upload session |
put_to_upload_url(url, body, content_type) |
PUT bytes to signed CDN URL |
client.uploads.complete() |
Finalize CDN upload |
client.uploads.upload() |
Session + CDN PUT + complete |
client.uploads.upload_direct() |
Server multipart direct upload |
client.uploads.upload_direct_batch() |
Multiple files in one request |
client.uploads.get_session() |
Poll session status |
client.uploads.wait_for_completion() |
Poll until COMPLETED |
client.files.get() |
File metadata |
client.files.access() |
Signed download URL |
client.files.delete() |
Delete file |
Use AsyncReupload and await for the same methods in async code.
CDN upload
from pathlib import Path
from reupload import Reupload, put_to_upload_url
client = Reupload(api_key="ru_…", default_project_id="…")
payload = Path("photo.jpg").read_bytes()
session = client.uploads.create_session(
{
"projectId": client.default_project_id,
"filename": "photo.jpg",
"contentType": "image/jpeg",
"size": len(payload),
"isPublic": True,
},
)
put_to_upload_url(session["uploadUrl"], payload, "image/jpeg")
done = client.uploads.complete({"uploadId": session["uploadId"]})
print(done["fileId"])
Or the combined helper:
done = client.uploads.upload(
{
"projectId": client.default_project_id,
"filename": "photo.jpg",
"contentType": "image/jpeg",
"size": len(payload),
"file": {
"data": payload,
"filename": "photo.jpg",
"contentType": "image/jpeg",
"size": len(payload),
},
},
)
Direct upload
result = client.uploads.upload_direct(
{
"projectId": client.default_project_id,
"isPublic": True,
"file": {
"data": payload,
"filename": "photo.jpg",
"contentType": "image/jpeg",
"size": len(payload),
},
},
)
FastAPI
from fastapi import FastAPI
from reupload import create_async_reupload_from_env
from reupload.fastapi import create_async_fastapi_direct_upload_handler
app = FastAPI()
client = create_async_reupload_from_env()
@app.post("/api/upload")
async def upload(request):
return await create_async_fastapi_direct_upload_handler(client=client)(request)
Or build the handler once:
upload_handler = create_async_fastapi_direct_upload_handler(client=client)
@app.post("/api/upload")
async def upload(request):
return await upload_handler(request)
Accepts multipart fields: projectId, file, optional filename, optional isPublic.
Errors
from reupload import ReuploadError, is_reupload_error, is_reupload_cdn_error
try:
client.files.get("…")
except ReuploadError as error:
print(error.status, error.code, error.message)
Development
cd python-packages/reupload-sdk
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
python -m build
License
MIT
Metadata
Release files for reupload-sdk 0.1.1
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 |
|---|---|---|---|---|
| reupload_sdk-0.1.1.tar.gz | 13.6 kB | Without provenance | Details for reupload_sdk-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reupload_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for reupload_sdk-0.1.1-py3-none-any.whl |
Total release size: 30.6 kB
Release files / reupload_sdk-0.1.1.tar.gz
| Download URL | reupload_sdk-0.1.1.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71c230edcc9a625b9d42ef5e6b52c796ee8e05a49cef1641aeef77db8c5a19c0
|
|
BLAKE2b-256 checksum How to use checksums |
3237ad54af7482a13bf48183a5654a4dcfa4ecf659bc74cd25b7fa460af6af8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / reupload_sdk-0.1.1-py3-none-any.whl
| Download URL | reupload_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c07adc403baee83a5d0f30c7fdf3528a05dcb8db0eee28a71948627e14f7ecd
|
|
BLAKE2b-256 checksum How to use checksums |
ca9d6de2fc92b0455c5f846d8f7df6a04ee61a186d4eb7ede75216701f55f16b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for reupload-sdk 0.1.1
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.