prdb-sdk (Python)
Python client for the prdb Public API.
Install
pip install prdb-sdk
Requires Python 3.10 or newer. The client is async and uses httpx under the
hood, by way of the Kiota bundle.
Usage
import asyncio
from uuid import UUID
from prdb_sdk import create_client
async def main() -> None:
client = create_client(api_key="...")
# GET /videos
page = await client.videos.get()
for video in page.items or []:
print(video.title)
# GET /videos/{id}
video = await client.videos.by_id(UUID("...")).get()
# Query parameters are typed, including the closed-set ones.
from prdb_sdk.generated.videos.videos_request_builder import VideosRequestBuilder
config = VideosRequestBuilder.VideosRequestBuilderGetRequestConfiguration(
query_parameters=VideosRequestBuilder.VideosRequestBuilderGetQueryParameters(
page=2,
page_size=50,
search="...",
)
)
page_two = await client.videos.get(request_configuration=config)
asyncio.run(main())
The request builders mirror the API's URL structure, so GET /videos/{id}/filehashes
is client.videos.by_id(video_id).filehashes.get().
Authentication
create_client sends the key in the X-Api-Key header, and keeps it on the API
host: a redirect to a different origin raises CrossOriginRedirectError rather
than handing your credential to whoever answers there. Redirects that stay on
the same origin are followed normally.
base_url must use https, so the key is never sent in cleartext.
GET /health is the only endpoint that works without a key; use
create_anonymous_client() for health probes. That one has no credential to
protect, so it accepts a plain http base URL.
Options
from prdb_sdk import RetryOptions, create_client
client = create_client(
api_key="...",
base_url="https://api.prdb.net", # override for a staging deployment
http_client=my_httpx_async_client, # control timeouts, proxies, connection limits
retry=RetryOptions.disabled(), # see below
)
The client you pass in is configured with the SDK's middleware in place, so it behaves like the one built for you — same redirect rule, same retry handling.
Retrying
By default the SDK retries a 429, 503 or 504 up to three times, honouring
Retry-After.
Turn that off if your application already retries prdb calls:
client = create_client("...", retry=RetryOptions.disabled())
Otherwise the two policies multiply — one logical call becomes up to n×m requests against an API that rate limits, and an outer circuit breaker never sees a stable failure to open on. The built-in policy also retries writes, so an application that must not repeat one should own the retry itself.
To keep it but change it:
client = create_client("...", retry=RetryOptions(max_retries=5, delay=1.0))
Generated code
Everything under prdb_sdk/generated/ is produced by Kiota from
spec/openapi.json in the repository root and is overwritten on every
regeneration. Do not edit it — see the root README.
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 prdb_sdk-0.3.0.tar.gz.
File metadata
- Download URL: prdb_sdk-0.3.0.tar.gz
- Upload date:
- Size: 51.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ae0d405adcd51fff298d9dad045c8594b142cda78f49c04832ba2d2162119d3
|
|
| MD5 |
fee57f6842845783e00e82557b9fbfb4
|
|
| BLAKE2b-256 |
a38a24c0bb0aca0af863fd10833727aa98447e17a8d5539bb8f78123a858c131
|
Provenance
The following attestation bundles were made for prdb_sdk-0.3.0.tar.gz:
Publisher:
release.yml on prdb-net/prdb-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prdb_sdk-0.3.0.tar.gz -
Subject digest:
1ae0d405adcd51fff298d9dad045c8594b142cda78f49c04832ba2d2162119d3 - Sigstore transparency entry: 2383797708
- Sigstore integration time:
-
Permalink:
prdb-net/prdb-sdk@e590080714bbbf3bf16c922bb61092e357798db5 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/prdb-net
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e590080714bbbf3bf16c922bb61092e357798db5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file prdb_sdk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: prdb_sdk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 220.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d469acc26d6988968400d08846171d7eb87a77f121fe1b2c1af9e90eee99a03
|
|
| MD5 |
44f435bf96ed4da4216bf5dc34e95eb9
|
|
| BLAKE2b-256 |
132658913d5465a00fb0635bd4cef228ff4b6be0ca4912a55708682dc4983c24
|
Provenance
The following attestation bundles were made for prdb_sdk-0.3.0-py3-none-any.whl:
Publisher:
release.yml on prdb-net/prdb-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prdb_sdk-0.3.0-py3-none-any.whl -
Subject digest:
6d469acc26d6988968400d08846171d7eb87a77f121fe1b2c1af9e90eee99a03 - Sigstore transparency entry: 2383798341
- Sigstore integration time:
-
Permalink:
prdb-net/prdb-sdk@e590080714bbbf3bf16c922bb61092e357798db5 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/prdb-net
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e590080714bbbf3bf16c922bb61092e357798db5 -
Trigger Event:
push
-
Statement type: