发送信息到钉钉群
from dingtalkchatbot.chatbot import DingtalkChatbot class SendText:
def __init__(self, webhook):
# 初始化机器人小丁
self.xiaoding = DingtalkChatbot(webhook) def send(self):
# Text消息@所有人
self.xiaoding.send_text(msg='我是机器人!', is_at_all=False) self.xiaoding.send_link(title='测试', text='测试环境', message_url=https:xxx.com')
self.xiaoding.send_link(title='测试', text='测试环境', message_url='https:xxx.com') if __name__ == '__main__':
# WebHook地址
webhook = 'https://oapi.dingtalk.com/robot/send?access_token=xxxxx'
send_text = SendText(webhook)
send_text.send()