导航

 

参考官方文档https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq

#coding=utf8
import requests
import json
url='https://oapi.dingtalk.com/robot/send?access_token=。。。'
# data=  {"actionCard": {
#         "title": "虚拟机数量监控",
#         "text": "没有虚拟机在运行哦",
#         "hideAvatar": "0",
#         "btnOrientation": "0",
#         "btns": [
#             {
#                 "title": "去关闭",
#                 "actionURL": "。。。"
#             }
#         ]
#     },
#     "msgtype": "actionCard"}
data={"msgtype": "text", 
        "text": {
             "content": "今日虚拟机数量:0,如需关闭请登录。。。"
        }
      }
header={'Content-Type': 'application/json'}
data=json.dumps(data,encoding='utf8')
res=requests.post(url,data=data,headers=header)
print res.text

  

posted on 2019-02-28 10:38  slqt  阅读(1280)  评论(0编辑  收藏  举报