1.在钉钉里面添加自定义机器人
2.获取https连接以及token
import json,urllib2,time
def dd():
url='https://oapi.dingtalk.com/robot/send?access_token=XXXXXX'
con={"msgtype":"text","text":{"content":"Hello from PYTHON !!!"}}
jd=json.dumps(con)
req=urllib2.Request(url,jd)
req.add_header('Content-Type', 'application/json')
response=urllib2.urlopen(req)
print response,time.ctime()
if __name__ == '__main__':
dd()
备注:Python 2.7.13