File: asgi2.py

package info (click to toggle)
python-uvicorn 0.38.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,932 kB
  • sloc: python: 9,184; sh: 48; makefile: 15
file content (15 lines) | stat: -rw-r--r-- 394 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from uvicorn._types import (
    ASGI2Application,
    ASGIReceiveCallable,
    ASGISendCallable,
    Scope,
)


class ASGI2Middleware:
    def __init__(self, app: "ASGI2Application"):
        self.app = app

    async def __call__(self, scope: "Scope", receive: "ASGIReceiveCallable", send: "ASGISendCallable") -> None:
        instance = self.app(scope)
        await instance(receive, send)