我们要进去群里设置
然后获取Webhook
企业自定义文档
https://ding-doc.dingtalk.com/doc#/serverapi2/elzz1p
import requests
import json
def dinding(mag):
HEADERS = {"Content-Type": "application/json;charset=utf-8"}
key = "access_token"
url = "xx/send?access_token=%s" % key
data_info = {
'msgtype' : 'text',
'text' : {'content' : '我想说的话:' + mag},
'isAtAll' : True
}
value = json.dumps(data_info)
response = requests.post(url, data=value, headers=HEADERS)
print(response.status_code)
if __name__ == '__main__':
msg = '总裁我错了'
dinding(msg)