Skip to main content

Agraffe, build API with ASGI in Serverless services (e.g AWS lambda, Google Cloud Functions and Azure Functions).

Project description

icon

PyPI version Test

Agraffe, build API with ASGI in Serverless services (e.g AWS lambda, Google Cloud Functions and Azure Functions).

Support Services

  • Google Cloud Functions
    • Python 3.7, 3.8, 3.9, 3.10, 3.11(preview)
  • AWS lambda (with API Gateway HTTP API or REST API, or with Function URL)
    • Python 3.7, 3.8, 3.9
  • Azure Functions
    • Python 3.7, 3.8, 3.9, 3.10(preview)

Requirements

Python 3.7+

Installation

$ pip install agraffe

Example

Create it

  • Create a file main.py with:
from agraffe import Agraffe

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: str | None = None):
    return {"item_id": item_id, "q": q}

entry_point = Agraffe.entry_point(app)
# or, for on GCP
from agraffe.services.google_cloud_functions import HttpCycle

def entry_point(request):
    return Agraffe(app, HttpCycle)(request=request)

Deploy it

  • Deploy the api with:
$ gcloud functions deploy {FUNCTION NAME} --entry-point entry_point --runtime python310 --trigger-http --allow-unauthenticated

See /example for other services.

License

This project is licensed under the terms of the MIT license.

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

agraffe-0.6.0.tar.gz (51.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agraffe-0.6.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file agraffe-0.6.0.tar.gz.

File metadata

  • Download URL: agraffe-0.6.0.tar.gz
  • Upload date:
  • Size: 51.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for agraffe-0.6.0.tar.gz
Algorithm Hash digest
SHA256 b99e9bb235cd7b98797dad6d661c673e4ed9184bcaf6f877e82dfab0b03925b2
MD5 baf36b1eaa3822a0e653008d7ae5da5d
BLAKE2b-256 c19a268e8bc876a1ab887ec956a0bb6225227fd293f7970bfc29b6adc232d2f1

See more details on using hashes here.

File details

Details for the file agraffe-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: agraffe-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.2

File hashes

Hashes for agraffe-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3be3ae750fe9b66cb6efffbf071c03e1e217f532cee05371e0d33f102d3455fd
MD5 698c9b8aca864ffe33111d7dac53d2d0
BLAKE2b-256 92e010a1ac1394b253ba2211b19e6ec403553d17c8365af771dff27b2a460138

See more details on using hashes here.

Supported by

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