An adapter for asgi to rsgi
Project description
rsgiadapter
An Asgi to rsgi adapter.
RSGI Specification ref: https://github.com/emmett-framework/granian/blob/master/docs/spec/RSGI.md
rsgiadapter
is an adapter for RSGI server run ASGI application like FastAPI and BlackSheep.
Usage:
app.py
import granian
from granian.constants import Interfaces
from rsgiadapter import ASGIToRSGI
app = None # Define your asgi application here
rsgi_app = ASGIToRSGI(app)
serve = granian.Granian("app:rsgi_app", interface=Interfaces.RSGI)
serve.serve()
with asgi lifespan:
from contextlib import asynccontextmanager
import granian
from granian.constants import Interfaces
from rsgiadapter import ASGIToRSGI
@asynccontextmanager
async def lifespan(_app):
print("lifespan start")
yield
print("lifespan stop")
app = None # Define your asgi application here
rsgi_app = ASGIToRSGI(app, lifespan=lifespan)
serve = granian.Granian("app:rsgi_app", interface=Interfaces.RSGI)
serve.serve()
Supported Feature:
- HTTP Request Response
- ASGI scope
- ASGI receive
- ASGI send
- Extensions
- http.response.pathsend
- websocket.http.response
- http.response.push
- http.response.zerocopysend
- http.response.early_hint
- http.response.trailers
- http.response.debug
- Lifespan
- lifespan.startup
- lifespan.startup.complete(silence)
- lifespan.startup.failed(will terminate)
- lifespan.shutdown
- lifespan.shutdown.complete(silence)
- lifespan.shutdown.failed(will terminate)
Ref:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rsgiadapter-0.0.6.tar.gz
(10.7 kB
view hashes)
Built Distribution
Close
Hashes for rsgiadapter-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84ece32389d3863621c991b2a4d7b1886111aa284cd75335c77c50f3c9da7633 |
|
MD5 | 158a77e8d2255138dda6c1e4550228d0 |
|
BLAKE2b-256 | 83f100368790a631fd90df35d47a08f00477c010a0f64613614e7bef16fa4f9f |