Python SDK for the Thingiverse API
Project description
Thingiverse Python SDK
A Python SDK for the Thingiverse API.
Installation
pip install thingiverse-client
Or from source:
pip install .
# or for development
pip install -e ".[dev]"
Quick start
from thingiverse import AuthenticatedClient, BASE_URL_PRODUCTION
from thingiverse.api.thing import get_things_thing_id
client = AuthenticatedClient(
base_url=BASE_URL_PRODUCTION,
token="YOUR_ACCESS_TOKEN",
)
response = get_things_thing_id.sync_detailed(thing_id=123, client=client)
Using the staging API
Use BASE_URL_STAGING to target the staging environment:
from thingiverse import AuthenticatedClient, BASE_URL_STAGING
client = AuthenticatedClient(base_url=BASE_URL_STAGING, token="...")
Authentication
The Thingiverse API uses Bearer token authentication. You can obtain a token from Thingiverse app settings or from browser network requests to api.thingiverse.com.
File uploads
File uploads (designs and images) use a specific flow. See the Thingiverse upload guide for details. The SDK exposes the generated uploadFile and FinalizeFiles endpoints; you may use a thin helper for the full upload flow (see docs).
Development setup
-
Clone the repository and create a virtual environment:
python3 -m venv .venv source .venv/bin/activate # or .venv\Scripts\activate on Windows pip install -e ".[dev]"
-
Install pre-commit hooks (including commit message format):
pre-commit install pre-commit install --hook-type commit-msg
-
Commit messages must follow Conventional Commits (e.g.
feat: add X,fix: Y). The commit-msg hook enforces this.
Running tests
Use the virtual environment’s Python so that dependencies (e.g. httpx) are found. Either activate the venv first (source .venv/bin/activate then pytest) or run:
.venv/bin/python -m pytest tests/unit tests/integration -v
-
Unit tests (default, no API calls):
pytest tests/unit -v
-
Integration tests (read-only, real API). Set
THINGIVERSE_TOKEN; optionally setTHINGIVERSE_BASE_URLfor staging:THINGIVERSE_TOKEN=... pytest tests/unit tests/integration -v
-
Destructive tests (optional; modify data). Not run in CI. Use a dedicated test account and prefer staging:
THINGIVERSE_BASE_URL=https://api-staging.thingiverse.com THINGIVERSE_TOKEN=... pytest -m destructive
Updating the API spec
To refresh the SDK from the upstream Thingiverse OpenAPI spec:
-
Run the fetch script (downloads the full spec; the docs URL may be behind Cloudflare—see script docstring):
python scripts/fetch_openapi_spec.py -
Bundle, run the upstream-spec fix script, and regenerate the client (see OpenAPI upstream notes):
./scripts/generate_client.sh
-
Commit changes and open a PR; merging can trigger a new release via release-please.
Documentation
Documentation is built with Zensical (reads mkdocs.yml) and published to GitHub Pages. Build locally:
pip install -e ".[dev]"
zensical serve
Publishing to PyPI
Publishing is automated via the Publish to PyPI workflow. When a GitHub release is published (e.g. by merging a release-please release PR), the workflow builds the package and uploads it to PyPI.
One-time setup:
- Create a PyPI account and register the project name
thingiverse-clientif needed. - Configure trusted publishing for this repository:
- PyPI: Add a new trusted publisher for the project.
- Set Owner and Repository name to this repo, Workflow name to
publish-pypi.yml. - No secrets or API tokens are required; PyPI uses OIDC to verify the workflow.
After that, each new release will be published to PyPI automatically. Optionally, add a GitHub Actions environment (e.g. pypi) and set environment: pypi in the workflow for approval or protection rules.
License
MIT.
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 thingiverse_client-1.1.0.tar.gz.
File metadata
- Download URL: thingiverse_client-1.1.0.tar.gz
- Upload date:
- Size: 170.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
899c36ac7c204317837e02f4ba918bcf3be5a6a797d0ec9862f004ad33c38636
|
|
| MD5 |
3b87bb5b8ad533f7c454b08a71358ec6
|
|
| BLAKE2b-256 |
746072d1d45bc95e41e28005e137c3f4fbef5c21306f47b480d9ed077dc3cefd
|
Provenance
The following attestation bundles were made for thingiverse_client-1.1.0.tar.gz:
Publisher:
publish-pypi.yml on nomike/thingiverse-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thingiverse_client-1.1.0.tar.gz -
Subject digest:
899c36ac7c204317837e02f4ba918bcf3be5a6a797d0ec9862f004ad33c38636 - Sigstore transparency entry: 1099409806
- Sigstore integration time:
-
Permalink:
nomike/thingiverse-client@357633bb174d1bd67cbf936f0f1c48db00d368aa -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/nomike
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@357633bb174d1bd67cbf936f0f1c48db00d368aa -
Trigger Event:
release
-
Statement type:
File details
Details for the file thingiverse_client-1.1.0-py3-none-any.whl.
File metadata
- Download URL: thingiverse_client-1.1.0-py3-none-any.whl
- Upload date:
- Size: 988.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e8ff9d6b673bbd23f36b5e2098bc3f5edd4531ce7b5ce477d6eb427a958a45e
|
|
| MD5 |
a99d62bec94c7a8e13253c2bc8ed5b21
|
|
| BLAKE2b-256 |
bc8548257e343ac122ee917ce2e9c21476bc6e70c5929a9301ed05231a7c20c0
|
Provenance
The following attestation bundles were made for thingiverse_client-1.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on nomike/thingiverse-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thingiverse_client-1.1.0-py3-none-any.whl -
Subject digest:
4e8ff9d6b673bbd23f36b5e2098bc3f5edd4531ce7b5ce477d6eb427a958a45e - Sigstore transparency entry: 1099409870
- Sigstore integration time:
-
Permalink:
nomike/thingiverse-client@357633bb174d1bd67cbf936f0f1c48db00d368aa -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/nomike
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@357633bb174d1bd67cbf936f0f1c48db00d368aa -
Trigger Event:
release
-
Statement type: