airflow.providers.apprise.hooks.apprise

AppriseHook

使用 Apprise(https://github.com/caronc/apprise) 与通知服务进行交互。

模块内容

class airflow.providers.apprise.hooks.apprise.AppriseHook(apprise_conn_id=default_conn_name)[source]

Bases: airflow.hooks.base.BaseHook

使用 Apprise(https://github.com/caronc/apprise) 与通知服务进行交互。

Apprise 支持的通知服务的完整列表可以在以下位置找到:https://github.com/caronc/apprise/wiki#notification-services

参数

apprise_conn_id (str) – Apprise 连接 ID,其 config 字段中配置了服务。

conn_name_attr = 'apprise_conn_id'[source]
default_conn_name = 'apprise_default'[source]
conn_type = 'apprise'[source]
hook_name ='Apprise'[source]
apprise_conn_id = 'apprise_default'[source]
get_config_from_conn()[source]
set_config_from_conn(apprise_obj)[source]

从连接设置配置到 Apprise 对象。

notify(body, title=None, notify_type=NotifyType.INFO, body_format=NotifyFormat.TEXT, tag='all', attach=None, interpret_escapes=None, config=None)[source]

发送消息到插入的服务。

参数
  • body (str) – 指定消息正文

  • title (str | None) – 指定消息标题。(可选)

  • notify_type (apprise.NotifyType) – 指定消息类型(默认为 info)。可能的值有 “info”、“success”、“failure” 和 “warning”

  • body_format (apprise.NotifyFormat) – 指定输入消息格式(默认为 text)。可能的值有 “text”、“html” 和 “markdown”。

  • tag (str | collections.abc.Iterable[str]) – 指定一个或多个标签来过滤要通知的服务

  • attach (apprise.AppriseAttachment | None) – 指定一个或多个文件附件位置

  • interpret_escapes (bool | None) – 启用对反斜杠转义字符的解释。例如,这将把诸如 n 和 r 之类的序列转换为其对应的 ASCII 换行符和回车符。

  • config (apprise.AppriseConfig | None) – 指定一个或多个配置

abstract get_conn()[source]

返回 Hook 的连接。

classmethod get_connection_form_widgets()[source]

返回要添加到连接表单的连接小部件。

classmethod get_ui_field_behaviour()[source]

此条目是否有帮助?