Skip to main content

AWS Lambda Event Handler

This package provides a decorator for Python Lambda functions handling individual records in the event payload of the AWS Lambda function.

Usage

This package provides two event decorators:

  • sns - used to handle invokations that origin from a SNS Topic.
  • dynamodb - used to handle invokations that origin from a DynamoDB Stream.

Defining the Handler

The following demonstrates how to create a handler object that will be used as the entrypoint for various event sources that trigger a AWS Lambda invokation:

from lambda_handler import LambdaHandler
handler = LambdaHandler() #pylint: disable=C0103

The handler object can then be used as a decorator for various Lambda Event Sources:

from lambda_handler import SNSMessage

@handler.sns
def sns(message: SNSMessage, context) -> None:
    """
    Handle SNS Message
    """
    print(message)

@handler.dynamodb
def dynamodb(record: dict, context) -> None:
    """
    Handle DynamoDB record
    """
    print(record)

Models

SNSMessage

The SNSMessage model makes it easier to interact with the data in the records and does some of the heavy lifting of pulling payload and attributes from the event letting you focus on your business logic.

Installation

pip install aws-lambda-event-handler

Requirements

None

Authors

Metadata

Release files for aws-lambda-event-handler 0.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 aws-lambda-event-handler 0.0.3
File Size Uploaded
aws_lambda_event_handler-0.0.3.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-lambda-event-handler 0.0.3
File Interpreter ABI Platform
aws_lambda_event_handler-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / aws_lambda_event_handler-0.0.3.tar.gz

Download URL aws_lambda_event_handler-0.0.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
978c81d35f741e821d2c4d434496c018ab91f51bdd6cd2456ebb4346ca093603
BLAKE2b-256 checksum
How to use checksums
fdaa0a8fae45c3ac9ad0203424bfff24553eb8b54857b4b35ffb1ef7eb74d297
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.4

Release files / aws_lambda_event_handler-0.0.3-py3-none-any.whl

Download URL aws_lambda_event_handler-0.0.3-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c01473151ec336031935a2bd8bb364ddb7031a9b15448370d306e8182257fa5f
BLAKE2b-256 checksum
How to use checksums
dc96dac893b7bb159b79cc6e8c0e70febab10dbb46a2c5a74dd513a13398619b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.4

Release history Release notifications | RSS feed

This release

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