This library adds the ability to handle RuntimeError: Caught handled exception, but response already started. error, so you can silent it, or do whatever you want
Installation 📥
python -m pip install -U starlette-ras-handle
Usage 🛠️
-
Define an async function that accepts
(Exception, Request | WebSocket)and returnsNoneasync def print_handler(exc: Exception, request: Request | WebSocket) -> None: print("Caught", exc)
-
Patch!
from handler import print_handler from starlette_ras_handle import handle_starlette_ras handle_starlette_ras(print_handler) # other imports...
IMPORTANT: If you want the patch to work properly, you should use it before you import anything, related to starlette (e.g. FastAPI)
You can check an example in /examples/example.py
Troubleshooting 🚨
If you encounter issues or have queries, feel free to check our Issues section on GitHub.
Contribution 🤝
Contributions are welcome. Please fork the repository, make your changes, and submit a pull request.
Metadata
Release files for starlette-ras-handle 1.0.2
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 | |
|---|---|---|---|---|
| starlette_ras_handle-1.0.2.tar.gz | 19.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| starlette_ras_handle-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.1 kB
Release files / starlette_ras_handle-1.0.2.tar.gz
| Download URL | starlette_ras_handle-1.0.2.tar.gz |
|---|---|
| Size | 19.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
030ffad47257cf13b4e7cbf54e2f5f4069f9d10fb2726d810fe6221d3f262f8f
|
|
BLAKE2b-256 checksum How to use checksums |
44452f99c28bce9ad78a79099b3468a0a7c0289fbf88cdff6519cfb7935f8460
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.6.14
|
Release files / starlette_ras_handle-1.0.2-py3-none-any.whl
| Download URL | starlette_ras_handle-1.0.2-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
29671f95475e8422f8627092fb813525fb0ed8a8fbce17caf34075b3bc989d44
|
|
BLAKE2b-256 checksum How to use checksums |
34a239378e85eed41e486f163838700d678ef16060c0d713c71a968cf0767600
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.6.14
|
Security for starlette-ras-handle 1.0.2
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.