Skip to main content

ASGI middleware for debugging ASGI applications

Project description

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

Project details


Release history Release notifications

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for asgi-debug, version 0.1
Filename, size & hash File type Python version Upload date
asgi_debug-0.1-py3-none-any.whl (6.2 kB) View hashes Wheel py3

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page