Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Python Deploy AWS Lambda Dispatcher

https://badge.fury.io/py/pd-aws-lambda.svg https://img.shields.io/badge/code%20style-black-000000.svg

Handle AWS Lambda events.

Events are passed to handlers for processing. Each event is passed to the handler in this order:

  • Handler defined in the event

  • HTTP events handler (for WSGI applications)

  • SQS events handler (if configured)

  • Default handler (if configured)

  • Logger handler (if no default is defined)

Provided Handlers

  • pd_aws_lambda.handlers.wsgi.handler: convert HttpAPI requests to WSGI environs.

  • pd_aws_lambda.handlers.shell.handler: Run shell commands.

  • pd_aws_lambda.handlers.logger.handler: log the received event and context.

Usage

  1. Add pd_aws_lambda to your application dependencies.

    poetry add pd_aws_lambda
  2. Set the required environment variables according to your needs in your Python Deploy application configuration.

    # Python path to the WSGI application that will handle HTTP requests.
    PD_WSGI_APPLICATION=my_django_project.wsgi.application
    
    # Python path to the handler for SQS events.
    PD_SQS_HANDLER=my_custom_handlers.sqs_handler
    
    # Python path to the default fallback handler.
    PD_DEFAULT_HANDLER=my_custom_handlers.default_handler

Custom handlers

A handler is a python function that receives an event and a context and does something with them. It can return a value if it makes sense for the type of event. For example, HttpAPI handlers like the one we use to call your wsgi application (pd_aws_lambda.handlers.wsgi.handler) should return a dictionary compatible with the AWS HttpAPI to form an HTTP response.

def handler(event, context):
    """
    I handle AWS Lambda invocations.

    I print the received event and context.
    """
    print("The event:", event)
    print("The context:", context)

Python Deploy

Metadata

Release files for pd-aws-lambda 2.0.0

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

Source distribution (sdist)

Source distribution for pd-aws-lambda 2.0.0
File Size Uploaded Provenance
pd_aws_lambda-2.0.0.tar.gz 5.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pd-aws-lambda 2.0.0
File Interpreter ABI Platform
pd_aws_lambda-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / pd_aws_lambda-2.0.0.tar.gz

Download URL pd_aws_lambda-2.0.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ca56223d267a3f2d6e20d74b6bab808ae6cd995b23d7930cf44287b2a9a5cb3e
BLAKE2b-256 checksum
How to use checksums
f1875ca33fea895167e5758b3550f3e7034b79cb0b6f3f7edaec867a4edd0019
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.10 CPython/3.9.7 Darwin/20.6.0

Release files / pd_aws_lambda-2.0.0-py3-none-any.whl

Download URL pd_aws_lambda-2.0.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4933a29a1b1c002b5679ab90c2d07d3040e910df1a5948f10f4d84e841d7974
BLAKE2b-256 checksum
How to use checksums
3fda095e61aad9ad1c3fe74b74b49478bb5bc45d40c4e86c29229db87531ae48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.10 CPython/3.9.7 Darwin/20.6.0

Security for pd-aws-lambda 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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