# 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": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Web App, Multi Cloud",
"author": "Claudjos",
"author_email": "claudjosmail@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/51/61/acf87e7c8ed919ffae117965ed5c6817a2d37063c0cf6e00b02d3a1515b8/chestnut-1.1.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",
"bugtrack_url": null,
"license": null,
"summary": "Framework to develop multi cloud APIs.",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/Claudjos/chestnut"
},
"split_keywords": [
"web app",
" multi cloud"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "19909953c5085a98552b5a9be8cfa0fdc46f05ce3bb8292a674b0653e61ef4fb",
"md5": "8f3e00d9179f6305cb529e65b07b3bbc",
"sha256": "caf979d91dd71ea0933c43e7181c38a7981d16ab0eb928855eb2755fc3ee8196"
},
"downloads": -1,
"filename": "chestnut-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8f3e00d9179f6305cb529e65b07b3bbc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6651,
"upload_time": "2024-07-02T10:45:22",
"upload_time_iso_8601": "2024-07-02T10:45:22.525094Z",
"url": "https://files.pythonhosted.org/packages/19/90/9953c5085a98552b5a9be8cfa0fdc46f05ce3bb8292a674b0653e61ef4fb/chestnut-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5161acf87e7c8ed919ffae117965ed5c6817a2d37063c0cf6e00b02d3a1515b8",
"md5": "4af8c197345218fee94dae1d5d8e8f1e",
"sha256": "4311ca3a05484b9b3c813cec4120a93441e82054d879bc5316a3b0e9fe4e7e63"
},
"downloads": -1,
"filename": "chestnut-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "4af8c197345218fee94dae1d5d8e8f1e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5711,
"upload_time": "2024-07-02T10:45:24",
"upload_time_iso_8601": "2024-07-02T10:45:24.113768Z",
"url": "https://files.pythonhosted.org/packages/51/61/acf87e7c8ed919ffae117965ed5c6817a2d37063c0cf6e00b02d3a1515b8/chestnut-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-02 10:45:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Claudjos",
"github_project": "chestnut",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "chestnut"
}