Skip to main content

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.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

vellox-0.1.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file vellox-0.1.0.tar.gz.

File metadata

  • Download URL: vellox-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for vellox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7962e9e404263599aaecc22768363c23fc219b9bd260311a43a3f261a14628d2
MD5 5df15d7c3036296c0477299daa84f839
BLAKE2b-256 8b5d19273f8767693e8c42c922b0755d587ec9887d81a26a13b044e76ea4c307

See more details on using hashes here.

File details

Details for the file vellox-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vellox-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for vellox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08c86f4f9a46a0b6e77166b6832b6d4374def8109904e20d0112be1a1a626b3b
MD5 d3cd08b02bf29f66f4befa0d4b2dbbc1
BLAKE2b-256 3aecca30c8331ef8286f024b8a322f39ac2a2a0db809f9c368944182d33ac707

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page