{"id":21164535,"url":"https://github.com/barabum0/starlette-ras-handle","last_synced_at":"2026-02-22T12:44:41.566Z","repository":{"id":233284195,"uuid":"786448844","full_name":"barabum0/starlette-ras-handle","owner":"barabum0","description":"This library patches starlette, so you can handle \"RuntimeError: Caught handled exception, but response already started.\" exception","archived":false,"fork":false,"pushed_at":"2025-04-20T17:22:40.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T11:48:41.444Z","etag":null,"topics":["fastapi","patch","python","starlette"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/starlette-ras-handle/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barabum0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-14T13:55:10.000Z","updated_at":"2025-04-20T17:22:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"484de41c-f1f7-4d75-aef1-994a71be3620","html_url":"https://github.com/barabum0/starlette-ras-handle","commit_stats":null,"previous_names":["barabum0/starlette-ras-handle"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/barabum0/starlette-ras-handle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barabum0%2Fstarlette-ras-handle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barabum0%2Fstarlette-ras-handle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barabum0%2Fstarlette-ras-handle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barabum0%2Fstarlette-ras-handle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barabum0","download_url":"https://codeload.github.com/barabum0/starlette-ras-handle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barabum0%2Fstarlette-ras-handle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261217293,"owners_count":23126247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","patch","python","starlette"],"created_at":"2024-11-20T14:06:27.482Z","updated_at":"2026-02-22T12:44:36.527Z","avatar_url":"https://github.com/barabum0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Starlette RAS-handler\n\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/starlette-ras-handle.svg?logo=python\u0026logoColor=FFE873)](https://pypi.org/project/starlette-ras-handle)\n[![PyPI version](https://img.shields.io/pypi/v/starlette-ras-handle.svg?logo=pypi\u0026logoColor=FFE873)](https://pypi.org/project/starlette-ras-handle)\n[![PyPI downloads](https://img.shields.io/pypi/dm/starlette-ras-handle.svg)](https://pypi.org/project/starlette-ras-handle)\n\n\u003c/div\u003e\n\nThis 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\n\n## Installation 📥\n\n```shell\npython -m pip install -U starlette-ras-handle \n```\n\n\n## Usage 🛠️\n1. Define an async function that accepts `(Exception, Request | WebSocket)` and returns `None`\n    ```python\n    async def print_handler(exc: Exception, request: Request | WebSocket) -\u003e None:\n        print(\"Caught\", exc)\n    ```\n\n2. Patch!\n    ```python\n    from handler import print_handler\n    \n    from starlette_ras_handle import handle_starlette_ras\n    handle_starlette_ras(print_handler)\n    \n    # other imports...\n    ```\n   \n**IMPORTANT:** If you want the patch to work properly, you should use it before you import anything, related to `starlette` (e.g. `FastAPI`)\n\nYou can check an example in `/examples/example.py`\n\n## Troubleshooting 🚨\n\nIf you encounter issues or have queries, feel free to check our [Issues section](https://github.com/barabum0/starlette-ras-handle/issues) on GitHub.\n\n## Contribution 🤝\n\nContributions are welcome. Please fork the repository, make your changes, and submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarabum0%2Fstarlette-ras-handle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarabum0%2Fstarlette-ras-handle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarabum0%2Fstarlette-ras-handle/lists"}