Skip to content

simonw/asgi-debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asgi-debug

PyPI CircleCI License

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

About

Debugging middleware for ASGI applications

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages