# 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Claudjos/chestnut",
"name": "chestnut",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Web App,Multi Cloud",
"author": "Claudjos",
"author_email": "claudjosmail@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/33/dd/60250b807bcd31d0f84ccbb6a94ca92b851d0835d85bea2ab41e294f6f0e/chestnut-1.0.0.tar.gz",
"platform": null,
"description": "# About\n\nThis package provides a framework to develop portable APIs. Supported platforms: Azure Functions, AWS Lambda, GPC, Flask.\n\n## Install\n```\npip install chestnut\n```\n\n## How to use\nWrite 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.\n```\nfrom chestnut.http import Request, Response\nfrom chestnut import middleware\n\n\n@middleware\ndef handler(req: Request) -> Response:\n\tmessage = \"Hello {} !\".format(\n\t\treq.query_params.get(\"name\", \"anonymous\")\n\t)\n\treturn Response(status=200, body=message)\n\n```\n\n## Unit test\n```\npip install -r requirements.txt -r test-requirements.txt\npython -m pytest tests/ --cov=chestnut\n```\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Framework to develop multi cloud APIs.",
"version": "1.0.0",
"split_keywords": [
"web app",
"multi cloud"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f3cff86b47dc4d2770bcd2a2acef418fd6cab519ee715fea4d31f72419814846",
"md5": "765f92ac8db4963f408812f1087d3268",
"sha256": "b2a8128b936ed11fabba7b6dd2f4bd78a3e0cef31c6742e0e892165883fa87f9"
},
"downloads": -1,
"filename": "chestnut-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "765f92ac8db4963f408812f1087d3268",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6614,
"upload_time": "2023-03-11T13:29:14",
"upload_time_iso_8601": "2023-03-11T13:29:14.612738Z",
"url": "https://files.pythonhosted.org/packages/f3/cf/f86b47dc4d2770bcd2a2acef418fd6cab519ee715fea4d31f72419814846/chestnut-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "33dd60250b807bcd31d0f84ccbb6a94ca92b851d0835d85bea2ab41e294f6f0e",
"md5": "7f285a1b065c278c4e22bea5aba3b488",
"sha256": "3c3eee94d6c92ccf7fad919b21760cd738f17072918bde938fb7677075ae3170"
},
"downloads": -1,
"filename": "chestnut-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "7f285a1b065c278c4e22bea5aba3b488",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5284,
"upload_time": "2023-03-11T13:29:16",
"upload_time_iso_8601": "2023-03-11T13:29:16.602232Z",
"url": "https://files.pythonhosted.org/packages/33/dd/60250b807bcd31d0f84ccbb6a94ca92b851d0835d85bea2ab41e294f6f0e/chestnut-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-11 13:29:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Claudjos",
"github_project": "chestnut",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "chestnut"
}