Implementation of RFC9457 problems.
Project description
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",
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rfc9457-0.4.1.tar.gz.
File metadata
- Download URL: rfc9457-0.4.1.tar.gz
- Upload date:
- Size: 70.1 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f754decf8cc42d93af40be455c77e0a1be19bef3826adf9feb91f849bcbd56a8
|
|
| MD5 |
d4e05e20e57f657ef36647d2b5e04b82
|
|
| BLAKE2b-256 |
6fbf9004fea8639bcbfdfa4f055a174520923dc151d7e2236fa00a62bf582009
|
File details
Details for the file rfc9457-0.4.1-py3-none-any.whl.
File metadata
- Download URL: rfc9457-0.4.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67d68b2b3194eb268ad59b27fba3126705366ebaaa5fc182e84ce2437c4b7d37
|
|
| MD5 |
3b17a2d484a627bd310826e63e30e13e
|
|
| BLAKE2b-256 |
d9e282adc9e1b4b93e958220adbc2aab4e55de5bf4f795c86897a82f0a7df79a
|