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 details)
Built Distribution
File details
Details for the file rsgiadapter-0.0.6.tar.gz
.
File metadata
- Download URL: rsgiadapter-0.0.6.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.15.4 CPython/3.12.3 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57c895b6b8d5ee6724fb874c9bdaeec872559b78094895e214b149466a760cda |
|
MD5 | 9bffa6d5e0e64d5e007183017948aa00 |
|
BLAKE2b-256 | b77af9843c5cb73517e78f1b3e6ad3d532100cdb9e2fa7cfe42722e636a88b4f |
File details
Details for the file rsgiadapter-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: rsgiadapter-0.0.6-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.15.4 CPython/3.12.3 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84ece32389d3863621c991b2a4d7b1886111aa284cd75335c77c50f3c9da7633 |
|
MD5 | 158a77e8d2255138dda6c1e4550228d0 |
|
BLAKE2b-256 | 83f100368790a631fd90df35d47a08f00477c010a0f64613614e7bef16fa4f9f |