run cgi scripts inside asgi
Project description
✨ asgi-cgi-handler ✨
-
run cgi scripts inside an asgi server
-
simple usage
import uvicorn
from asgi_cgi import HTTPCGIHandler, WebsocketCGIHandler
uvicorn.run(HTTPCGIHandler())
- A more complex example
from fastapi import FastAPI
from asgi_cgi import HTTPCGIHandler, WebsocketCGIHandler
app = FastAPI(title="CGI Server")
app.mount("/cgi-bin", HTTPCGIHandler()) # type: ignore
app.mount("/ws", WebsocketCGIHandler()) # type: ignore
As you can see, we have websocket support, which is inspired by websocketd. Currently, more tests are needed.
The WebsocketCGIHandler
route requests to endpoint executables and feed websocket data
into process's stdin and send stdout to client line by line.
Apis
ErrHandler = Callable[[bytes], Union[Awaitable[None], None]]
class HTTPCGIHandler:
def __init__(self, directory: str=..., error_handler: ErrHandler=...) -> None: ...
class WebsocketCGIHandler:
def __init__(self, directory: str=..., error_handler: ErrHandler=...) -> None: ...
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
Close
Hashes for asgi-cgi-handler-0.0.1.dev1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a24b3f597489c0370ddc34088ee1919b752081cf1f0d702d9dd9a57fd9922097 |
|
MD5 | 139ca954453af3b62c2ca0819ff8dcc7 |
|
BLAKE2b-256 | aee1f82577188500cbd9aa3bdc7b3be5b1029d52545a4e2b0b3bdbc42bfd1b58 |
Close
Hashes for asgi_cgi_handler-0.0.1.dev1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51a65ddfbe10ce52f1cabede053e56c8a2aa63ec6a4f7a29855193d3e625b1c7 |
|
MD5 | 29b909fb6aadfeabc4a651fd5fdc2cff |
|
BLAKE2b-256 | 08da0926550ab46e87a4ed33baf74a5f2d4d9c4e19fb7fa287e4d48fa887e03d |