Framework to develop multi cloud APIs.
Project description
About
This package provides a framework to develop portable APIs. Supported platforms: Azure Functions, AWS Lambda, GPC, Flask.
Install
pip install chestnut
How to use
Write functions to handle your API operations using the package chestnut.http request/response classes. The decorator @middleware will convert requests/responses from/to the current platform, which is defined in the environment variable CHESTNUT_MIDDLEWARE. It supports both functions and coroutines.
from chestnut.http import Request, Response
from chestnut import middleware
@middleware
def handler(req: Request) -> Response:
message = "Hello {} !".format(
req.query_params.get("name", "anonymous")
)
return Response(status=200, body=message)
Unit test
pip install -r requirements.txt -r test-requirements.txt
python -m pytest tests/ --cov=chestnut
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chestnut-1.1.1.tar.gz.
File metadata
- Download URL: chestnut-1.1.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dc01cfc53acb02eefc2ecc0e8a25dbb4c5ac2cd3fdb65ed07251dfcefa89adb
|
|
| MD5 |
dcdcd95450e53c3ff28aa95928d091f2
|
|
| BLAKE2b-256 |
2ae4184ac5a436c12dc285072bf528b5b2c52479d050c9c61e07bdba5d276aca
|
File details
Details for the file chestnut-1.1.1-py3-none-any.whl.
File metadata
- Download URL: chestnut-1.1.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88aec54dccbbdc61528005c2cfaf41d97af069d9ea2c310ea248fffe114c3802
|
|
| MD5 |
6031558bec49f1c7cc22d9bea36a8a8e
|
|
| BLAKE2b-256 |
6b3d738e88cba1eb2049b8198c222225460ad7a6b294be1b278e316f5135e34a
|