Skip to main content

test Latest Version Python Support

lambdarest Buy Me A Coffee

Python routing mini-framework for AWS Lambda with optional JSON-schema validation.

Features

  • lambda_handler function constructor with built-in dispatcher
  • Decorator to register functions to handle HTTP methods
  • Optional JSON-schema input validation using same decorator

Merchandise ❤️

You can support the development by buying a wonderful cup or buy coffee for the maintainers cup

lambdarest mug

External articles / tutorials

Other articles? add them here

Installation

Install the package from PyPI using pip:

$ pip install lambdarest

Getting Started

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":{}}

Documentation

See docs for documentation and examples covering amongst:

Anormal unittest behaviour with lambda_handler singleton

Because 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.

Tests

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...

Changelog

See HISTORY.md

Contributors

Thanks for contributing!

@sphaugh, @amacks, @jacksgt, @mkreg, @aphexer, @nabrosimoff, @elviejokike, @eduardomourar, @devgrok, @AlbertoTrindade, @paddie, @svdgraaf, @simongarnier, @martinbuberl, @adamelmore, @sloev

Wanna contribute?

And by the way, we have a Code Of Friendlyhood!

Release files for lambdarest 13.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lambdarest 13.0.3
File Size Uploaded
lambdarest-13.0.3.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lambdarest 13.0.3
File Interpreter ABI Platform
lambdarest-13.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 26.6 kB

Release files / lambdarest-13.0.3.tar.gz

Download URL lambdarest-13.0.3.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e177130d49ead512dd2f5ee14e8fb5d4c266cc9dc548b9b23a14deb6fa95cf5e
BLAKE2b-256 checksum
How to use checksums
97987faadc7212790adfe4f59f0c31a28f48c804114c884db0d694ce2e3d2d01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / lambdarest-13.0.3-py3-none-any.whl

Download URL lambdarest-13.0.3-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ed65e3530af289165def7e1662be1504b20dd4c60f30f5cc1ba1fbeab399a00
BLAKE2b-256 checksum
How to use checksums
322aedecbf915d056ae0c7c84d8ce3c592b75c18059b4e38d20b70e53e48bef8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

13.0.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page