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+
Installation
pip install vellox
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.3.tar.gz
(8.5 kB
view details)
Built Distribution
vellox-0.1.3-py3-none-any.whl
(10.8 kB
view details)
File details
Details for the file vellox-0.1.3.tar.gz
.
File metadata
- Download URL: vellox-0.1.3.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1538c87bbedc5088ebdf4d390b024b7cb72c1466669a4e0a84a07eb301ef8bc |
|
MD5 | e8b6fa3aa5e38e2019af08e2937c49d2 |
|
BLAKE2b-256 | 19190d8ce9d0e8ecde6a1ba4915cc292841dce6f147ad2ea34ff767511c24659 |
File details
Details for the file vellox-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: vellox-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 378f4d5ca36be4269d9a699225f6216900f034882ea7930f16d4f30c41747b9d |
|
MD5 | 234832b67f7a669897166fcaf575a7ee |
|
BLAKE2b-256 | 511538c74ca4f2498626770fcfe8ab982b47da57752e1762ca7b850e977e0b46 |