UploadThing adapter for files-sdk
Project description
files-sdk-uploadthing
UploadThing adapter for files-sdk.
Sync and async variants over httpx, with locally-computed HMAC presigned
URLs (ported from the upstream TypeScript SDK — no UT-side roundtrip for
upload URL generation).
Install
uv add files-sdk files-sdk-uploadthing
Usage
from files_sdk import Files
from files_sdk_uploadthing import UploadThingAdapter
files = Files(adapter=UploadThingAdapter()) # reads UPLOADTHING_TOKEN
files.upload("users/123/avatar.png", b"...")
print(files.download("users/123/avatar.png").as_bytes())
Async:
from files_sdk_uploadthing import AsyncUploadThingAdapter
a = AsyncUploadThingAdapter()
await a.upload("users/123/avatar.png", b"...")
Auth
Set UPLOADTHING_TOKEN (the base64 JSON token from your UploadThing
dashboard's API Keys page) in the environment, or pass token= explicitly.
The decoded apiKey is the only secret sent — the token's appId and
regions are extracted client-side.
Notes on the protocol mapping
The adapter's key: str maps to UploadThing's customId, so paths like
users/123/avatar.png round-trip cleanly. The opaque per-file fileKey is
generated client-side and never surfaced. A few protocol mismatches are
handled transparently:
- No prefix filter on
listFiles— fetched pages are filtered in Python. Thecursoris a stringified offset. Large accounts will see this. - No server-side
copy— implemented as download + reupload. - No HEAD endpoint —
head()uses a one-byte ranged GET; theContent-Rangeheader carries the true size. - CDN routing by
customIddoesn't resolve unicode keys — falls back to/v6/getFileUrl(one extra API roundtrip) when the direct fetch 404s.
Development
Live conformance tests require UPLOADTHING_TOKEN:
export UPLOADTHING_TOKEN=eyJh...
uv run pytest packages/files-sdk-uploadthing/
Without the token, only the offline tests (_token, _signing, _hash)
run; the conformance suite skips.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file files_sdk_uploadthing-0.1.0a2.tar.gz.
File metadata
- Download URL: files_sdk_uploadthing-0.1.0a2.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f8ea94ed85f9741ad1f452e84ed6e34aaf07780e933654f0ac75a3b16fe04c6
|
|
| MD5 |
7a170f18b47a780e0d94ead99f9cdaf5
|
|
| BLAKE2b-256 |
84cfe6f6c77ac0a66084e978883fc14c05e4c5c273b87912f3ec381ad7abfaf5
|
Provenance
The following attestation bundles were made for files_sdk_uploadthing-0.1.0a2.tar.gz:
Publisher:
release.yml on menelsystems/files-sdk-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
files_sdk_uploadthing-0.1.0a2.tar.gz -
Subject digest:
3f8ea94ed85f9741ad1f452e84ed6e34aaf07780e933654f0ac75a3b16fe04c6 - Sigstore transparency entry: 1537587407
- Sigstore integration time:
-
Permalink:
menelsystems/files-sdk-py@8ce2c02c06fe92f05febd2d7ae6cbcfb92388c81 -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/menelsystems
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8ce2c02c06fe92f05febd2d7ae6cbcfb92388c81 -
Trigger Event:
push
-
Statement type:
File details
Details for the file files_sdk_uploadthing-0.1.0a2-py3-none-any.whl.
File metadata
- Download URL: files_sdk_uploadthing-0.1.0a2-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cde3aa99a594a0104b93340f6f47622818ffdc32fc9adeef2829a6ad15e63ad
|
|
| MD5 |
5cecbac94acacd264ef0a5bd11d9d983
|
|
| BLAKE2b-256 |
00ac1bf6a0d90d82f54d01f33cd053e52da1d08c5252de9b9342a1b80dd5f60e
|
Provenance
The following attestation bundles were made for files_sdk_uploadthing-0.1.0a2-py3-none-any.whl:
Publisher:
release.yml on menelsystems/files-sdk-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
files_sdk_uploadthing-0.1.0a2-py3-none-any.whl -
Subject digest:
4cde3aa99a594a0104b93340f6f47622818ffdc32fc9adeef2829a6ad15e63ad - Sigstore transparency entry: 1537587654
- Sigstore integration time:
-
Permalink:
menelsystems/files-sdk-py@8ce2c02c06fe92f05febd2d7ae6cbcfb92388c81 -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/menelsystems
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8ce2c02c06fe92f05febd2d7ae6cbcfb92388c81 -
Trigger Event:
push
-
Statement type: