Skip to main content

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

Project description

PyPI version

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

Support Services

  • Google Cloud Functions
  • AWS lambda (with API Gateway HTTP API or REST API)
  • Azure Functions

Requirements

Python 3.7+

Installation

$ pip install agraffe

Example

Create it

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

from typing import Optional

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: Optional[str] = None):
    return {"item_id": item_id, "q": q}


entry_point = Agraffe.entry_point(app, Service.google_cloud_functions)

Deploy it

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

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

Uploaded Source

Built Distribution

agraffe-0.3.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agraffe-0.3.0.tar.gz
Algorithm Hash digest
SHA256 41baf5fe7eb2e3cac8a4d6ce211c7367a79d8538cbfd59a1631cee85e70a5c6f
MD5 0dfd2065fdd611e96d550c9df81e6da2
BLAKE2b-256 b498409260744959966566e1817358419e194145965c7429a01adeb6b21a93f5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for agraffe-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a69e9dd39a32f8dd7c0df0ec7cdb22a10ca9e73970a8a9d56220c68d799ddd14
MD5 3ba9d0c19934ced749acb3325769732f
BLAKE2b-256 a120c72c8c72f129c8e67af9dbd0be0c67a6da1267a5f49af2c9354b2dfa3b48

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