Agraffe, build API with ASGI in Serverless services (e.g AWS lambda, Google Cloud Functions).
Project description
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 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.2.0.tar.gz
(7.4 kB
view details)
Built Distribution
File details
Details for the file agraffe-0.2.0.tar.gz
.
File metadata
- Download URL: agraffe-0.2.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.24.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f95ea6dffb0d78b9b50e7170dba9c89886da72b783fad411ed48e4bb07311eab |
|
MD5 | 8dc406b605bd4a429a6c4dee88f8884a |
|
BLAKE2b-256 | 693e8bf5de9a2957fc485b68e0f9aedd0780f687668f951282b75ecf333bf7a3 |
File details
Details for the file agraffe-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: agraffe-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.24.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5f761e643542f6287886f4e2f299f24129686bf4f39eef324dfdfa3aada02f6 |
|
MD5 | d1256064c3d8676cae77ab6eb8ed00f6 |
|
BLAKE2b-256 | 2b4a83829b84d93d93fb25b1ea35cc6e826b61e985cf8aab77c6ba321495da26 |