700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > python钉钉机器人发送excel附件_python 钉钉机器人发送消息

python钉钉机器人发送excel附件_python 钉钉机器人发送消息

时间:2020-03-18 05:04:05

相关推荐

python钉钉机器人发送excel附件_python 钉钉机器人发送消息

import json

import requests

def sendmessage(message):

url = '/robot/send?access_xxxxxxx' #钉钉机器人的webhook地址

HEADERS = {

"Content-Type": "application/json ;charset=utf-8 "

}

message = message

String_textMsg = {

"msgtype": "text",

"text": {"content": message},

"at": {

"atMobiles": [

"130xxxxxxxx" #如果需要@某人,这里写他的手机号

],

"isAtAll": 1 #如果需要@所有人,这些写1

}

}

String_textMsg = json.dumps(String_textMsg)

res = requests.post(url, data=String_textMsg, headers=HEADERS)

print(res.text)

if '__name__' == '__main__':

sendmessage('test')

##钉钉开放平台地址

https://open-/docs/doc.htm?treeId=257&articleId=105735&docType=1

钉钉的webhook机器人地址

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。