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
Release files for chestnut 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chestnut-1.1.1.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chestnut-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / chestnut-1.1.1.tar.gz
| Download URL | chestnut-1.1.1.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6dc01cfc53acb02eefc2ecc0e8a25dbb4c5ac2cd3fdb65ed07251dfcefa89adb
|
|
BLAKE2b-256 checksum How to use checksums |
2ae4184ac5a436c12dc285072bf528b5b2c52479d050c9c61e07bdba5d276aca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.12
|
Release files / chestnut-1.1.1-py3-none-any.whl
| Download URL | chestnut-1.1.1-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88aec54dccbbdc61528005c2cfaf41d97af069d9ea2c310ea248fffe114c3802
|
|
BLAKE2b-256 checksum How to use checksums |
6b3d738e88cba1eb2049b8198c222225460ad7a6b294be1b278e316f5135e34a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.12
|