Skip to main content

SDK for the DriveThruRPG API

Project description

dtrpg-sdk.py

CI License: MIT

A Python SDK for the DriveThruRPG API.

Requires Python 3.12+.

Provides configuration, the credential-login and application-key auth flows, session lifecycle management, and a LibraryClient covering order products, download preparation, and product lists/product list items. For a reference implementation of the same API surface in another language, see the Go, Rust, or Swift SDKs.

Installation

Not yet published to PyPI. Once released:

uv add dtrpg-sdk

Quick Start

from dtrpg_sdk import Config, DriveThruRpgSdk, LibraryItemsParams
from dtrpg_sdk.auth import key_exchange

config = Config(application_key="my-app-key")
sdk = DriveThruRpgSdk.with_config(config)

# Exchange the application key for a session token.
token_response = key_exchange.authenticate("my-app-key", config)
sdk.apply_auth_response(token_response)

# Build an authenticated library client and fetch the user's library.
client = sdk.library_client()
products = client.list_order_products(LibraryItemsParams(page=1, page_size=25))
for item in products.data:
    print(item.attributes.name)

Building from source

This repository uses the dtrpg-api repository as a submodule (API/), matching the pattern used by the Go/Rust/Swift SDKs. Clone with submodules, or initialize them after cloning:

git clone --recursive https://github.com/pilgrimagesoftware/dtrpg-sdk.py.git

# or, if already cloned:
git submodule update --init --recursive

Development

uv sync --all-extras --dev
uv run ruff check .
uv run ruff format --check .
uv run pyrefly check
uv run pytest

See docs/python.md in the umbrella repo for the full set of conventions this project follows.

Release Process

See RELEASE.md.

License

MIT — see LICENSE.md.

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

dtrpg_sdk-0.3.0.tar.gz (68.7 kB view details)

Uploaded Source

Built Distribution

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

dtrpg_sdk-0.3.0-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file dtrpg_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: dtrpg_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 68.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dtrpg_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 59e5b309af223460e522fb964a4456f3d7279c114423239f6f38ecb69ca7b87a
MD5 81e0573f29748ff8599aeb161b23595f
BLAKE2b-256 9a58ee8926bd3be8456b4fb2b8a7c4e70a5ef4710984e4afdce070f6b3243ccf

See more details on using hashes here.

File details

Details for the file dtrpg_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dtrpg_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dtrpg_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f75089d6b5fe128129045b51837645664fbee9373eb376c8c8cbf8d0a6b2049b
MD5 a59854f39a9b181590625fdb07917ba4
BLAKE2b-256 6fa030a9787c28734994a5ca1b40007993faf7f2c132526d5e457c5fb9ded0f8

See more details on using hashes here.

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