Skip to main content

This package provides a decorator for Python Lambda functions handling AWS Lambda Event Records.

Project description

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

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

aws_lambda_event_handler-0.0.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

aws_lambda_event_handler-0.0.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file aws_lambda_event_handler-0.0.3.tar.gz.

File metadata

  • Download URL: aws_lambda_event_handler-0.0.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for aws_lambda_event_handler-0.0.3.tar.gz
Algorithm Hash digest
SHA256 978c81d35f741e821d2c4d434496c018ab91f51bdd6cd2456ebb4346ca093603
MD5 b0fd89bc49d2d5cdaaaaf630932ec2a2
BLAKE2b-256 fdaa0a8fae45c3ac9ad0203424bfff24553eb8b54857b4b35ffb1ef7eb74d297

See more details on using hashes here.

File details

Details for the file aws_lambda_event_handler-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: aws_lambda_event_handler-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for aws_lambda_event_handler-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c01473151ec336031935a2bd8bb364ddb7031a9b15448370d306e8182257fa5f
MD5 37b818aca24420cc668f4d0df7bdc27e
BLAKE2b-256 dc96dac893b7bb159b79cc6e8c0e70febab10dbb46a2c5a74dd513a13398619b

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