asgi-cgi-handler-0.0.1.dev1
توضیحات
run cgi scripts inside asgi
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | asgi-cgi-handler-0.0.1.dev1 |
| نام | asgi-cgi-handler |
| نسخه کتابخانه | 0.0.1.dev1 |
| نگهدارنده | ['synodriver'] |
| ایمیل نگهدارنده | [] |
| نویسنده | synodriver |
| ایمیل نویسنده | diguohuangjiajinweijun@gmail.com |
| آدرس صفحه اصلی | https://github.com/synodriver/asgi-cgi-handler |
| آدرس اینترنتی | https://pypi.org/project/asgi-cgi-handler/ |
| مجوز | GPLv3 |
<h1 align="center"><i>✨ asgi-cgi-handler ✨ </i></h1>
[](https://pypi.org/project/asgi-cgi-handler/)





- run cgi scripts inside an asgi server
- simple usage
```python
import uvicorn
from asgi_cgi import HTTPCGIHandler, WebsocketCGIHandler
uvicorn.run(HTTPCGIHandler())
```
- A more complex example
```python
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](https://github.com/joewalnes/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
```python
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: ...
```
نیازمندی
| مقدار | نام |
|---|---|
| - | starlette |
| - | h11 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl asgi-cgi-handler-0.0.1.dev1:
pip install asgi-cgi-handler-0.0.1.dev1.whl
نصب پکیج tar.gz asgi-cgi-handler-0.0.1.dev1:
pip install asgi-cgi-handler-0.0.1.dev1.tar.gz