huudis (Python)
Official Python SDK for Huudis. Works with FastAPI, Flask, Django, or anything else that speaks WSGI/ASGI.
Install
pip install huudis
Quickstart
Set env vars (or pass them to the client):
HUUDIS_ISSUER=https://huudis.com
HUUDIS_AUDIENCE=oc_your_client_id
HUUDIS_CLIENT_ID=oc_your_client_id
HUUDIS_CLIENT_SECRET=cs_... # omit for public clients (PKCE)
Verify an access token
from fastapi import FastAPI, Header, HTTPException
from huudis import verify_access_token, HuudisAuthError
app = FastAPI()
@app.get("/me")
def me(authorization: str = Header(...)):
try:
claims = verify_access_token(authorization)
except HuudisAuthError as e:
raise HTTPException(401, detail=e.message)
return {"user_id": claims.sub, "email": claims.email}
OIDC sign-in flow
from huudis import HuudisClient
huudis = HuudisClient()
# Step 1: redirect the user
url = huudis.authorization_url(
redirect_uri="https://yourapp.com/callback",
state=session["state"],
code_challenge=session["pkce_challenge"],
)
# Step 2: exchange the code
tokens = huudis.exchange_code(
code=request.args["code"],
redirect_uri="https://yourapp.com/callback",
code_verifier=session["pkce_verifier"],
)
userinfo = huudis.userinfo(tokens["access_token"])
Authorization check
result = huudis.authz_check(
access_token=token,
principal={"type": "user", "id": claims.sub, "accountId": claims.account_id},
action="plugipay:DeleteInvoice",
resource="forjio:plugipay::acc_.../invoice/inv_9F8",
)
if not result["allow"]:
raise HTTPException(403, detail=result.get("reason"))
Types
| Name | Description |
|---|---|
verify_access_token(header_or_token, *, issuer=None, audience=None, require_mfa=False) |
Module-level convenience — reads HUUDIS_ISSUER / HUUDIS_AUDIENCE from env. |
HuudisClient(issuer=..., client_id=..., client_secret=..., audience=..., api_base=...) |
Full surface. Use as a context manager (with HuudisClient() as huudis:) or call .close(). |
HuudisClaims |
Dataclass returned by verification — sub, email, account_id, scope, mfa_verified, etc. |
HuudisAuthError |
Raised on any failure; carries .code + .message. |
JWKS is cached in-process via PyJWT's PyJWKClient.
Docs
- Full docs: https://huudis.com/docs
- Source: https://github.com/hachimi-cat/saas-huudis/tree/master/sdk/python
License
MIT
Metadata
Release files for huudis 0.4.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 |
|---|---|---|---|---|
| huudis-0.4.0.tar.gz | 16.0 kB | Without provenance | Details for huudis-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| huudis-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for huudis-0.4.0-py3-none-any.whl |
Total release size: 34.6 kB
Release files / huudis-0.4.0.tar.gz
| Download URL | huudis-0.4.0.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ca25b0b5b1b0e7738e150593ddf5152de10e250bdd34838e606c46053b927d5
|
|
BLAKE2b-256 checksum How to use checksums |
f68551deb9f5e00d4b44d6b9253c31dbfd88b8620f0c39a8b0a577ff0b842c98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / huudis-0.4.0-py3-none-any.whl
| Download URL | huudis-0.4.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
294eb5d839d18c1222538df936bcca9c77a3c300481388a52e2d2b5f41b0b5cf
|
|
BLAKE2b-256 checksum How to use checksums |
9cf9b44ea4a3311c34ca6e39dfc6bb0c403423eb02af466d930eea0bb2f8d153
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for huudis 0.4.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.