Skip to main content

Easily construct and send formatted emails and Slack alerts.

Project description

Easily construct and send formatted emails and Slack alerts.

Configuration is done through environment variables. See settings.py

Install

pip install alert_msgs

Examples

from alert_msgs import ContentType, FontSize, Map, Text, Table, send_alert, send_slack_message, send_email
from uuid import uuid4
import random

components = [
    Text(
        "Important things have happened.",
        size=FontSize.LARGE,
        color=ContentType.IMPORTANT,
    ),
    Map({"Field1": "Value1", "Field2": "Value2", "Field3": "Value3"}),
    Table(
        rows=[
            {
                "Process": "thing-1",
                "Status": 0,
                "Finished": True,
            },
            {
                "Process": "thing-2",
                "Status": 1,
                "Finished": False,
            }
        ],
        caption="Process Status",
    ),
]

# Send via method-specific functions.
send_email(subject="Test Alert", components=components)
send_slack_message(components)

# Send using config from environment variables.
send_alert(components, subject="Test Alert")

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

alert_msgs-0.3.0.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distribution

alert_msgs-0.3.0-py3-none-any.whl (10.8 kB view hashes)

Uploaded Python 3

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