# Notification Tasks
Collection of tasks for sending notifications.
Useful for situations in which state handlers are inappropriate.
# EmailTask
class
prefect.tasks.notifications.email_task.EmailTask
(subject=None, msg=None, email_to=None, email_from="notifications@prefect.io", smtp_server="smtp.gmail.com", smtp_port=465, smtp_type="SSL", msg_plain=None, email_to_cc=None, email_to_bcc=None, attachments=None, **kwargs)[source]Task for sending email from an authenticated email service over SMTP. For this task to function properly, you must have the "EMAIL_USERNAME"
and "EMAIL_PASSWORD"
Prefect Secrets set. It is recommended you use a Google App Password if you use Gmail. The default SMTP server is set to the Gmail SMTP server on port 465 (SMTP-over-SSL). Sending messages containing HTML code is supported - the default MIME type is set to the text/html.
Args:
subject (str, optional)
: the subject of the email; can also be provided at runtimemsg (str, optional)
: the contents of the email, added as html; can be used in combination of msg_plain; can also be provided at runtimeemail_to (str, optional)
: the destination email address to send the message to; can also be provided at runtimeemail_from (str, optional)
: the email address to send from; defaults to notifications@prefect.iosmtp_server (str, optional)
: the hostname of the SMTP server; defaults to smtp.gmail.comsmtp_port (int, optional)
: the port number of the SMTP server; defaults to 465smtp_type (str, optional)
: either SSL or STARTTLS; defaults to SSLmsg_plain (str, optional)
: the contents of the email, added as plain text can be used in combination of msg; can also be provided at runtimeemail_to_cc (str, optional)
: additional email address to send the message to as cc; can also be provided at runtimeemail_to_bcc (str, optional)
: additional email address to send the message to as bcc; can also be provided at runtimeattachments (List[str], optional)
: names of files that should be sent as attachment; can also be provided at runtime**kwargs (Any, optional)
: additional keyword arguments to pass to the base Task initialization
methods: |
---|
prefect.tasks.notifications.email_task.EmailTask.run (subject=None, msg=None, email_to=None, email_from=None, smtp_server=None, smtp_port=None, smtp_type=None, msg_plain=None, email_to_cc=None, email_to_bcc=None, attachments=None)[source] |
Run method which sends an email.
|
# SlackTask
class
prefect.tasks.notifications.slack_task.SlackTask
(message=None, webhook_secret="SLACK_WEBHOOK_URL", **kwargs)[source]Task for sending a message via Slack. For this task to function properly, you must have a Prefect Secret set which stores your Slack webhook URL. For installing the Prefect App, please see these installation instructions.
Args:
message (str, optional)
: the message to send as either a dictionary or a plain string; can also be provided at runtimewebhook_secret (str, optional)
: the name of the Prefect Secret which stores your slack webhook URL; defaults to"SLACK_WEBHOOK_URL"
**kwargs (Any, optional)
: additional keyword arguments to pass to the base Task initialization
methods: |
---|
prefect.tasks.notifications.slack_task.SlackTask.run (message=None, webhook_secret=None, webhook_url=None)[source] |
Run method which sends a Slack message.
|
# PushbulletTask
Task for sending a notification to a mobile phone (or other device) using pushbullet. For this task to function properly, you must have the "PUSHBULLET_TOKEN"
Prefect Secret set. You can set up a pushbullet account and/or get a token here: https://www.pushbullet.com/#settings/account
Args:
msg(str, optional)
: The message you want to send to your phone; can also be provided at runtime.**kwargs (Any, optional)
: additional keyword arguments to pass to the standard Task init method
methods: |
---|
prefect.tasks.notifications.pushbullet_task.PushbulletTask.run (msg=None, access_token=None)[source] |
Run method for this Task. Invoked by calling this Task after initialization within a Flow context, or by using
|
This documentation was auto-generated from commit n/a
on July 1, 2021 at 18:35 UTC