Skip to main content

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

  1. 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]"
    
  2. Install pre-commit hooks (including commit message format):

    pre-commit install
    pre-commit install --hook-type commit-msg
    
  3. 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 set THINGIVERSE_BASE_URL for 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:

  1. Run the fetch script (downloads the full spec; the docs URL may be behind Cloudflare—see script docstring):

    python scripts/fetch_openapi_spec.py
    
  2. Bundle, run the upstream-spec fix script, and regenerate the client (see OpenAPI upstream notes):

    ./scripts/generate_client.sh
    
  3. 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:

  1. Create a PyPI account and register the project name thingiverse-client if needed.
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thingiverse_client-1.1.1.tar.gz (169.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thingiverse_client-1.1.1-py3-none-any.whl (983.1 kB view details)

Uploaded Python 3

File details

Details for the file thingiverse_client-1.1.1.tar.gz.

File metadata

  • Download URL: thingiverse_client-1.1.1.tar.gz
  • Upload date:
  • Size: 169.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for thingiverse_client-1.1.1.tar.gz
Algorithm Hash digest
SHA256 58a207cedb3c0c73cfedbbcd70acafb88cac01cb00be5bffe066788b4eee3dbf
MD5 4abb2c74ee88871a397d46759f42fdc7
BLAKE2b-256 5f64310853c9b77a8f56fcbc0a73e3c90fb34c1da2e825c0ee19fa0076680725

See more details on using hashes here.

Provenance

The following attestation bundles were made for thingiverse_client-1.1.1.tar.gz:

Publisher: publish-pypi.yml on nomike/thingiverse-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thingiverse_client-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for thingiverse_client-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 43e81a759fb39c5091c467d9adb4c7d455a60d1a893b5b406b80e22c283472c8
MD5 b850303e3a0da09ef32afe6dd6fa223b
BLAKE2b-256 3325461ce4a7f74d063da20d065ef55e8c5013fb0429d6f7229e981173f767f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for thingiverse_client-1.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on nomike/thingiverse-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page