airflow.providers.dingding.hooks.dingding

DingdingHook

使用钉钉自定义机器人 API 发送消息。

模块内容

class airflow.providers.dingding.hooks.dingding.DingdingHook(dingding_conn_id='dingding_default', message_type='text', message=None, at_mobiles=None, at_all=False, *args, **kwargs)[source]

继承自:airflow.providers.http.hooks.http.HttpHook

使用钉钉自定义机器人 API 发送消息。

参数:
  • dingding_conn_id – 钉钉连接 ID,其密码字段中包含 access token,主机字段中包含可选的主机名。如果未设置主机,将使用默认值 https://oapi.dingtalk.com

  • message_type (str) – 要发送到钉钉的消息类型,目前支持五种类型:textlinkmarkdownactionCardfeedCard

  • message (str | dict | None) – 发送到聊天群组的消息

  • at_mobiles (list[str] | None) – 使用此消息提醒特定用户

  • at_all (bool) – 是否提醒群组中所有人。如果为 True,将覆盖 at_mobiles

conn_name_attr = 'dingding_conn_id'[source]
default_conn_name = 'dingding_default'[source]
conn_type = 'dingding'[source]
hook_name = 'DingTalk Custom Robot (Dingding)'[source]
message_type = 'text'[source]
message = None[source]
at_mobiles = None[source]
at_all = False[source]
get_conn(headers=None, extra_options=None)[source]

覆盖 HttpHook get_conn 方法。

我们只需要 base_url 和 headers,不需要通用参数。

参数:
  • headers (dict[Any, Any] | None) – 作为字典传递的附加 headers

  • extra_options (dict[str, Any] | None) – 传递给连接的额外选项(已忽略)

send()[source]

发送钉钉自定义机器人消息。

此条目是否有帮助?