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
Release history Release notifications | RSS feed
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)
Built Distribution
alert_msgs-0.3.0-py3-none-any.whl
(10.8 kB
view hashes)
Close
Hashes for alert_msgs-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3f95b482370d728bf683622ad33a6cbf7267f39a14267bd112f9b50dd71394c |
|
MD5 | 9ac11ca368f5de4cfad4a1f465c51318 |
|
BLAKE2b-256 | aaf9a5e7c40a3310f7bf5d5a69f6add15f10a5f6ba4354197d1ab33ce0fb9e41 |