Skip to main content

Provides a Django app and a lambda handler for sending emails concerning errors in AWS

Project description

Currently only supports failed step functions. This is half-baked so far

Usage

# settings.py

INSTALLED_APPS = [
    "django_serverless_emailer",
    # ...
]

AWS_REGION = "us-west-2"  # your region

DEFAULT_FROM_EMAIL = "an-email@email.com"  # your sender
EMAIL_HOST = "smtp.gmail.com"  # your host
EMAIL_PORT = 465  # your port
EMAIL_HOST_USER = "an-email@email.com"  # your user
EMAIL_HOST_PASSWORD = os.getenv["EMAIL_PASSWORD"]
EMAIL_USE_SSL = True  # if you're using SSL

EMAIL_RECEPIENTS = "a@b.com,c@d.com"  # comma delimited list or a plain list
# serverless.yml

functions:
  notify:
    handler: path/to/handler.send_email
    description: Send an email when there's something in the queue
    layers:
      - { Ref: PythonRequirementsLambdaLayer }
    timeout: 10
    environment:
      DJANGO_SETTINGS_MODULE: setup.settings # path to your settings module
    events:
      - sqs:
          arn:
            Fn::GetAtt:
              - ErrorNotificationDlq
              - Arn
# handler.py

import django
import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "setup.settings")
django.setup()

from django_serverless_emailer.handler import notify


def send_email(event, _):
    notify(event, _)

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

django-serverless-emailer-0.1.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-serverless-emailer-0.1.1.tar.gz.

File metadata

File hashes

Hashes for django-serverless-emailer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 38933dc3417a8795f78c24dda13154c0c1c0f63ce96e93fae97873bacd51fb78
MD5 8b23f06c607dd92fa94c83676347402a
BLAKE2b-256 7b3d3520ee7a67923e574ca1eaf74875240f0cb0b0c285038e997fac9a02d9c2

See more details on using hashes here.

File details

Details for the file django_serverless_emailer-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_serverless_emailer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b31b41e9b4f2f3e459debc8e1f261ac80cff6ad5af1461598e36e02e1a43350d
MD5 dc9af2ba88bbe79d01e2177e58a650c4
BLAKE2b-256 657c8e227c1b2efb428449542ed987bd8ec31d96450f3c4a1bbdf454348b0cf6

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