Python routing mini-framework for AWS Lambda with optional JSON-schema validation.
Python routing mini-framework for AWS Lambda with optional JSON-schema validation.
lambda_handler
function constructor with built-in dispatcherYou can support the development by buying a wonderful cup or buy coffee for the maintainers cup
devgrok.com: Create a Private Microservice Using an Application Load Balancer
Article about how to use lambdarest with AWS Application Load Balancer
rockset.com: Building a Serverless Microservice Using Rockset and AWS Lambda
Article about how to set up lambdarest in AWS infrastructure
Other articles? add them here
Install the package from PyPI using pip:
$ pip install lambdarest
This module helps you to handle different HTTP methods in your AWS Lambda.
from lambdarest import lambda_handler
@lambda_handler.handle("get")
def my_own_get(event):
return {"this": "will be json dumped"}
##### TEST #####
input_event = {
"body": '{}',
"httpMethod": "GET",
"resource": "/"
}
result = lambda_handler(event=input_event)
assert result == {"body": '{"this": "will be json dumped"}', "statusCode": 200, "headers":{}}
See docs for documentation and examples covering amongst:
lambda_handler
singletonBecause of python unittests leaky test-cases it seems like you shall beware of this issue when using the singleton lambda_handler
in a multiple test-case scenario.
Use the following commands to install requirements and run test-suite:
$ pip install -e ".[dev]"
$ black tests/ lambdarest/
$ rm -f test_readme.py
$ pytest --doctest-modules -vvv
For more info see Contributing…
See HISTORY.md
Thanks for contributing!
@sphaugh, @amacks, @jacksgt, @mkreg, @aphexer, @nabrosimoff, @elviejokike, @eduardomourar, @devgrok, @AlbertoTrindade, @paddie, @svdgraaf, @simongarnier, @martinbuberl, @adamelmore, @sloev
And by the way, we have a Code Of Friendlyhood!