asgi-debug
ASGI middleware for debugging ASGI applications
Installation
pip install asgi-debug
Usage
Wrap your application in the middleware like this:
from asgi_debug import asgi_debug_decorator
@asgi_debug_decorator()
async def hello_world_app(scope, receive, send):
assert scope["type"] == "http"
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [[b"content-type", b"application/json"]],
}
)
await send({"type": "http.response.body", "body": b'{"hello": "world"}'})
When you run the app, debugging information will print to your terminal.
If you save the above in demo.py you can pip install uvicorn and run it like this:
uvicorn demo:hello_world_app
Release files for asgi-debug 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asgi_debug-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / asgi_debug-0.1-py3-none-any.whl
| Download URL | asgi_debug-0.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c59d50ec333c54f986ce436a19b93029355c692d17683d5b5a46ab27dcd87d5d
|
|
BLAKE2b-256 checksum How to use checksums |
234aab2fbfb9e718adf4488433f4f722d77fb8949d7fdfaab93f0d298981fd6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8
|