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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file chestnut-1.1.0.tar.gz.

File metadata

  • Download URL: chestnut-1.1.0.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

Hashes for chestnut-1.1.0.tar.gz
Algorithm Hash digest
SHA256 4311ca3a05484b9b3c813cec4120a93441e82054d879bc5316a3b0e9fe4e7e63
MD5 4af8c197345218fee94dae1d5d8e8f1e
BLAKE2b-256 5161acf87e7c8ed919ffae117965ed5c6817a2d37063c0cf6e00b02d3a1515b8

See more details on using hashes here.

File details

Details for the file chestnut-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: chestnut-1.1.0-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

Hashes for chestnut-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 caf979d91dd71ea0933c43e7181c38a7981d16ab0eb928855eb2755fc3ee8196
MD5 8f3e00d9179f6305cb529e65b07b3bbc
BLAKE2b-256 19909953c5085a98552b5a9be8cfa0fdc46f05ce3bb8292a674b0653e61ef4fb

See more details on using hashes here.

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