{"id":16217271,"url":"https://github.com/synodriver/asgi-cgi-handler","last_synced_at":"2025-04-07T23:14:49.587Z","repository":{"id":58497121,"uuid":"531982269","full_name":"synodriver/asgi-cgi-handler","owner":"synodriver","description":"run cgi scripts inside asgi, and with websocket, sse support","archived":false,"fork":false,"pushed_at":"2023-12-09T07:08:10.000Z","size":26,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T00:23:52.729Z","etag":null,"topics":["asgi","cgi","websocket"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/synodriver.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-09-02T15:32:50.000Z","updated_at":"2022-09-05T12:48:10.000Z","dependencies_parsed_at":"2024-11-03T20:25:10.601Z","dependency_job_id":"e7ca73d0-c163-4de9-8db1-bca01b9a873f","html_url":"https://github.com/synodriver/asgi-cgi-handler","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"3f075dbc4820be5ae5ba38abae0c5e16c0154ea9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fasgi-cgi-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fasgi-cgi-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fasgi-cgi-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fasgi-cgi-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/synodriver","download_url":"https://codeload.github.com/synodriver/asgi-cgi-handler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744333,"owners_count":20988783,"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":["asgi","cgi","websocket"],"created_at":"2024-10-10T11:26:22.005Z","updated_at":"2025-04-07T23:14:49.553Z","avatar_url":"https://github.com/synodriver.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\u003ci\u003e✨ asgi-cgi-handler ✨ \u003c/i\u003e\u003c/h1\u003e\n\n[![pypi](https://img.shields.io/pypi/v/asgi-cgi-handler.svg)](https://pypi.org/project/asgi-cgi-handler/)\n![python](https://img.shields.io/pypi/pyversions/asgi-cgi-handler)\n![implementation](https://img.shields.io/pypi/implementation/asgi-cgi-handler)\n![wheel](https://img.shields.io/pypi/wheel/asgi-cgi-handler)\n![license](https://img.shields.io/github/license/synodriver/asgi-cgi-handler.svg)\n![action](https://img.shields.io/github/workflow/status/synodriver/asgi-cgi-handler/build%20wheel)\n\n- run cgi scripts inside an asgi server\n\n\n- simple usage\n```python\nimport uvicorn\nfrom asgi_cgi import HTTPCGIHandler, WebsocketCGIHandler\n\nuvicorn.run(HTTPCGIHandler())\n```\n\n- A more complex example\n```python\nfrom fastapi import FastAPI\nfrom asgi_cgi import HTTPCGIHandler, WebsocketCGIHandler, SSECGIHandler\n\napp = FastAPI(title=\"CGI Server\")\n\napp.mount(\"/cgi-bin\", HTTPCGIHandler())  # type: ignore\napp.mount(\"/ws\", WebsocketCGIHandler())  # type: ignore\napp.mount(\"/sse\", SSECGIHandler())  # type: ignore\n```\n\nAs you can see, we have websocket support, which is inspired by\n[websocketd](https://github.com/joewalnes/websocketd). Currently, more tests are needed.\n\nThe ```WebsocketCGIHandler``` route requests to endpoint executables and feed websocket data\ninto process's stdin and send stdout to client line by line.\n\nThe ```SSECGIHandler```, means ```server send event```, is just like the websocket one, but it only send stdout to client.\n\n\n## Apis\n\n```python\nErrHandler = Callable[[bytes], Union[Awaitable[None], None]]\n\nclass HTTPCGIHandler:\n    def __init__(self, directory: str=..., error_handler: ErrHandler=...) -\u003e None: ...\n\nclass WebsocketCGIHandler:\n    def __init__(self, directory: str=..., error_handler: ErrHandler=...) -\u003e None: ...\n\nclass SSECGIHandler:\n    def __init__(self, directory: str=..., error_handler: ErrHandler=...) -\u003e None: ...\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynodriver%2Fasgi-cgi-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynodriver%2Fasgi-cgi-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynodriver%2Fasgi-cgi-handler/lists"}