axowl-sdk (Python)
Backend SDK for Axowl: verify Axowl end-user access tokens on your server,
read the caller's permissions, and — when a decision must see revocations made after the token was
issued — ask Axowl directly. Mirrors @axowl/sdk-backend (Node) and Axowl.Sdk.Identity.Client (.NET).
pip install axowl-sdk # + "axowl-sdk[fastapi]" for the FastAPI dependency
Verify a token (no server round trip)
from axowl import AxowlConfig, verify_token, has_permission, AxowlAuthError
config = AxowlConfig(
org_slug="my-org", # your Axowl org
audience="app_my_main", # optional: your application key — rejects tokens minted for another app
base_url="https://api.axowl.com", # default
)
try:
ctx = verify_token(bearer_token, config)
except AxowlAuthError as e:
... # e.reason ∈ missing_token | invalid_token | expired | signature | issuer | audience | jwks
ctx.user_id, ctx.email, ctx.org_slug, ctx.connected_id, ctx.is_employee
ctx.permissions # ["wallet.read", "report.*"] — decoded from the token
has_permission(ctx.permissions, "report.monthly") # True (wildcards honoured)
- Signature: RS256 against
{base_url}/api/public/orgs/{org_slug}/.well-known/jwks.json. Keys are cached for 10 minutes; an unknownkid(rotation) triggers a re-fetch. - Issuer must equal
{base_url}/api/public/orgs/{org_slug}— what Axowl writes into the token. exp/nbfenforced (leeway_secondson the config if your clock drifts).
FastAPI
from fastapi import Depends, FastAPI
from axowl import AxowlConfig, AxowlContext
from axowl.fastapi import AxowlAuth
auth = AxowlAuth(AxowlConfig(org_slug="my-org", audience="app_my_main"))
app = FastAPI()
@app.get("/wallet")
def wallet(ctx: AxowlContext = Depends(auth)):
return {"user": ctx.email}
@app.post("/wallet/withdraw")
def withdraw(ctx: AxowlContext = Depends(auth.require("wallet.withdraw"))):
...
401 {"error": ..., "reason": ...} for a missing/invalid token, 403 {"error": ..., "required": [...]}
for a missing scope — the same shapes as the Express middleware.
Any other framework: call extract_bearer_token(request.headers["Authorization"]) then verify_token.
Server-authoritative checks
The JWT fast path cannot see a permission revoked after the token was issued. For those decisions
ask Axowl with your org API key (ah_live_…):
from axowl import AxowlIdentityClient
identity = AxowlIdentityClient(api_key="ah_live_...", base_url="https://api.axowl.com")
res = identity.introspect(bearer_token) # → IntrospectResult(active, principal, expires_at, issued_at)
res = identity.check_permission(bearer_token, "wallet.withdraw") # → PermissionCheckResult(granted, matched_scopes, reason)
Both are synchronous and stdlib-only (urllib); run them in a thread from async code.
Permission matching
Same rules as every other Axowl SDK and the server:
| pattern | scope | match |
|---|---|---|
sap.fi.document.post |
sap.fi.document.post |
yes |
sap.fi.* |
sap.fi.document.post |
yes |
* |
anything | yes |
sap.fi |
sap.fi.document.post |
no (a prefix without * is not a wildcard) |
Tests
pip install -e ".[test]" && pytest
Release files for axowl-sdk 0.1.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 | |
|---|---|---|---|
| axowl_sdk-0.1.0.tar.gz | 12.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| axowl_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / axowl_sdk-0.1.0.tar.gz
| Download URL | axowl_sdk-0.1.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1aea3388e3f9686fb75f4e9af4ceead6f0752c6257175f7946074b1bbe2ae3e4
|
|
BLAKE2b-256 checksum How to use checksums |
493ea7d228bd9f21c047c760413da64776413088f1900de9c99d741ce6bf95c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / axowl_sdk-0.1.0-py3-none-any.whl
| Download URL | axowl_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e27e8f579ba03fc91819bf9ab15aa62f3eaef35242e57e465b5c9416bafd8b35
|
|
BLAKE2b-256 checksum How to use checksums |
2051bb0b85678428911ab525240711656c11734e63e1036f698e03046617a69f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency log