ASGI middleware for debugging ASGI applications
Project description
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
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asgi_debug-0.1-py3-none-any.whl.
File metadata
- Download URL: asgi_debug-0.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c59d50ec333c54f986ce436a19b93029355c692d17683d5b5a46ab27dcd87d5d
|
|
| MD5 |
03e91f161ecf0adf20277231062e5643
|
|
| BLAKE2b-256 |
234aab2fbfb9e718adf4488433f4f722d77fb8949d7fdfaab93f0d298981fd6d
|