标签:char 文本格式 tps atm set app 指定 bho cat
import requests
import json
def dingmessage():
webhook = "https://oapi.dingtalk.com/robot/send?access_token=efe407f2a73..."
header = {
"Content-Type": "application/json",
"Charset": "UTF-8"
}
# text文本格式
# message = {
# "msgtype": "text",
# "at": {
# "atMobiles": ["187xxx"],
# "isAtAll": False
# },
# "text": {
# "content": "test" #发送的内容
# }
# }
# markdown文本格式
message = {
"msgtype": "markdown",
"markdown": {
"title": "短信请求",
"text": "test @187xxxx"
},
"at": {
# @指定报警人
"atMobiles": ["187xxxx"],
"isAtAll": False
}
}
message_json = json.dumps(message)
print(message_json)
info = requests.post(url=webhook,data=message_json,headers=header)
print(info.text)
if __name__=="__main__":
dingmessage()
标签:char 文本格式 tps atm set app 指定 bho cat
原文地址:https://blog.51cto.com/14163901/2496273