Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

✨ asgi-cgi-handler ✨

pypi python implementation wheel license action

  • 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: ...

Metadata

Release files for asgi-cgi-handler 0.0.1.dev1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asgi-cgi-handler 0.0.1.dev1
File Size Uploaded
asgi-cgi-handler-0.0.1.dev1.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asgi-cgi-handler 0.0.1.dev1
File Interpreter ABI Platform
asgi_cgi_handler-0.0.1.dev1-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / asgi-cgi-handler-0.0.1.dev1.tar.gz

Download URL asgi-cgi-handler-0.0.1.dev1.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a24b3f597489c0370ddc34088ee1919b752081cf1f0d702d9dd9a57fd9922097
BLAKE2b-256 checksum
How to use checksums
aee1f82577188500cbd9aa3bdc7b3be5b1029d52545a4e2b0b3bdbc42bfd1b58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.8.2 requests/2.24.0 setuptools/60.9.3 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.5

Release files / asgi_cgi_handler-0.0.1.dev1-py3-none-any.whl

Download URL asgi_cgi_handler-0.0.1.dev1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51a65ddfbe10ce52f1cabede053e56c8a2aa63ec6a4f7a29855193d3e625b1c7
BLAKE2b-256 checksum
How to use checksums
08da0926550ab46e87a4ed33baf74a5f2d4d9c4e19fb7fa287e4d48fa887e03d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.8.2 requests/2.24.0 setuptools/60.9.3 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.1.dev1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page