Skip to main content

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

chestnut-1.1.0.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

chestnut-1.1.0-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page