puid-client
The official Python client for the PUID API — the Provably Unique IDentifier service. Every id is guaranteed distinct by construction, not by the dice roll a random UUID makes.
- Zero dependencies — built on the standard library (
urllib). - Python 3.9+.
Install
pip install puid-client
Quickstart
from puid import Puid
puid = Puid(api_key="puid_live_...") # mint one in the dashboard
one = puid.id()
ids = puid.ids(5) # 1–10 per request
ordinal = puid.ordinal(one) # int — the counter it encodes
quota = puid.quota() # {"plan", "used", "limit", "remaining"}
Mint an API key in the dashboard after signing in.
Generating ids on someone else's behalf (OAuth2)
If you've registered an OAuth2 client, exchange its credentials for a bearer token and generate ids for the account that granted you access — without ever touching their API key:
from puid import Puid
puid = Puid.from_client_credentials(
client_id="...",
client_secret="...",
scope="puid:generate", # default
)
puid.ids(3)
Already have a bearer token (e.g. from the authorization-code flow)? Pass it directly:
puid = Puid(access_token="puid_at_...")
API
Puid(api_key=None, access_token=None, endpoint="https://puid.dev/api", opener=None)
Provide exactly one of api_key or access_token.
endpoint— API endpoint. Defaults tohttps://puid.dev/api. Point it at a local dev server for tests, or at your own domain for a self-hosted (Enterprise) PUID.opener— an optionalurllibopener (advanced / testing).
Methods
ids(count=1) -> list[str]— generate 1–10 ids.id() -> str— generate a single id.ordinal(puid) -> int— decode an id back to its counter value.quota() -> dict— check today's quota; does not spend an id.Puid.from_client_credentials(client_id, client_secret, scope="puid:generate", endpoint=...) -> Puid
Self-hosted / Enterprise
puid = Puid(api_key="...", endpoint="https://ids.yourcompany.com/api")
Errors
Every non-2xx response (and client-side validation) raises PuidError:
from puid import Puid, PuidError
try:
puid.ids(3)
except PuidError as err:
err.status # 401 | 402 | 429 | … (None for client-side/network errors)
err.code # "rate_limited" | "quota_exceeded" | "unauthorized" | "network_error" | …
Common server codes: unauthorized (401), quota_exceeded (402),
rate_limited (429). PUID is rate limited to one request per second — that 429
is by design.
License
AGPL-3.0-only. See the repository.
Metadata
Release files for puid-client 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| puid_client-1.0.0.tar.gz | 18.8 kB | Without provenance | Details for puid_client-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| puid_client-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for puid_client-1.0.0-py3-none-any.whl |
Total release size: 35.6 kB
Release files / puid_client-1.0.0.tar.gz
| Download URL | puid_client-1.0.0.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc6fef2e31f436eb7c29daf0d61f194dbabbde0d144bf3330e8b141a5087f3d9
|
|
BLAKE2b-256 checksum How to use checksums |
2cd5b3deb0a146fae287948f0c4d07989b869aef29bdd167324088486f0b2702
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / puid_client-1.0.0-py3-none-any.whl
| Download URL | puid_client-1.0.0-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ee40716587c5768f35ca7eed12acc550dad74d87a5da61e9c05860675137e30
|
|
BLAKE2b-256 checksum How to use checksums |
0a2b9595e092297377e0db765308715609e68a14b090b44b9055d0e7f1bff7ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for puid-client 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.