RFC9457 implementation for Python
rfc9457 is a set of exceptions to support easy error management and responses
in web based apis.
Each exception easily marshals to JSON based on the RFC9457 spec for use in api errors.
This library is currently used to support problem details in both Starlette and FastAPI.
starlette-problem fastapi-problem
Custom Errors
Subclassing the convenience classes provides a simple way to consistently raise the same error with details/extras changing based on the raised context.
from rfc9457 import NotFoundProblem
class UserNotFoundError(NotFoundProblem):
title = "User not found."
UserNotFoundError(
detail="details",
custom_key="value",
).marshal()
{
"type": "user-not-found",
"title": "User not found",
"status": 404,
"detail": "details",
"custom_key": "value",
}
Metadata
Release files for rfc9457 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rfc9457-0.4.1.tar.gz | 70.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rfc9457-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.9 kB
Release files / rfc9457-0.4.1.tar.gz
| Download URL | rfc9457-0.4.1.tar.gz |
|---|---|
| Size | 70.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f754decf8cc42d93af40be455c77e0a1be19bef3826adf9feb91f849bcbd56a8
|
|
BLAKE2b-256 checksum How to use checksums |
6fbf9004fea8639bcbfdfa4f055a174520923dc151d7e2236fa00a62bf582009
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rfc9457-0.4.1-py3-none-any.whl
| Download URL | rfc9457-0.4.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67d68b2b3194eb268ad59b27fba3126705366ebaaa5fc182e84ce2437c4b7d37
|
|
BLAKE2b-256 checksum How to use checksums |
d9e282adc9e1b4b93e958220adbc2aab4e55de5bf4f795c86897a82f0a7df79a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|