GCP Cloud Functions support for ASGI applications
Project description
Vellox
Vellox is an adapter for running ASGI applications in GCP Cloud Functions.
Requirements
Python 3.8+
Example
from vellox import Vellox
async def app(scope, receive, send):
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [[b"content-type", b"text/plain; charset=utf-8"]],
}
)
await send({"type": "http.response.body", "body": b"Hello, world!"})
vellox = Vellox(app=app, lifespan="off")
def handler(request):
return vellox(request)
Or using a framework:
from fastapi import FastAPI
from vellox import Vellox
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
return {"item_id": item_id, "q": q}
vellox = Vellox(app=app, lifespan="off")
def handler(request):
return vellox(request)
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
vellox-0.1.2.tar.gz
(8.3 kB
view details)
Built Distribution
vellox-0.1.2-py3-none-any.whl
(10.8 kB
view details)
File details
Details for the file vellox-0.1.2.tar.gz
.
File metadata
- Download URL: vellox-0.1.2.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1359a96f2b8ed17f7feba4949c74d4f2f05655e5a2a228638baf33c3b1aa976b |
|
MD5 | 20a1be704e9a7a0670fb8ef43f033e65 |
|
BLAKE2b-256 | ab953633d971d8dcbc20e666aa3f38bb1abda69ea64becc215f41d6032225a7a |
File details
Details for the file vellox-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: vellox-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22113fdf0258e71a23abb06844ff3e78b7ab609389ca80f6daa874fb39116bda |
|
MD5 | fe1ced7582ed97145b33ef88fcfe84ad |
|
BLAKE2b-256 | d36fb7e2d0160452137c600072681a621b7016529b0749fa1b4bbe11605623be |