theauth package is the Python client for the theAuth REST API. It is built on httpx and ships a sync client and an async client with the same surface. Python 3.9 or newer.
Installation
Create a client
Resources
MCP servers
Plugin routes
Call routes declared withdefineEndpoint through request(). It returns the parsed JSON body.
ValidationError with the server issues. A 403 CSRF_REJECTED raises PermissionError, and a 429 raises RateLimitError with retry_after.
DPoP
DPoPAuth signs each request with an ES256 key pair, as described in RFC 9449.
- The
Authorizationheader becomesDPoP <token>and the proof carries anathclaim. htudrops the query and fragment.- The server
DPoP-Nonceis cached per origin and ause_dpop_nonceresponse is retried once.
DPoPAuth is a plain httpx.Auth, so you can also pass it to your own httpx.Client or httpx.AsyncClient. The cryptography package is imported lazily and a clear error is raised if it is missing.Errors
All exceptions inherit fromTheAuthError and carry code, message and status_code.
Related
Client SDK
The TypeScript fetch client this package mirrors.
Expo
React Native and Expo integration.