小夏的第一个钉钉机器人
###钉钉机器人实例#!/usr/bin/env python-- coding:utf-8 --import urllib2import jsonclass DingDing(object):def init(self):self.url = ‘https://oapi.dingtalk.com/robot/send?access_token=0192ec88a09f0f5b354...
·
###钉钉机器人实例
#!/usr/bin/env python
-- coding:utf-8 --
import urllib2
import json
class DingDing(object):
def init(self):
self.url = ‘https://oapi.dingtalk.com/robot/send?access_token=0192ec88a09f0f5b3545df3e2e70ef93ab563738861d7c79191fb75e608bd41a’
#夏正炜机器人链接
self.headers = {‘Content-Type’: “application/json; charset=utf-8”, ‘User-Agent’:
‘Mozilla/5.0 (Windows; U;Windows NT 6.1; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6’}
def http_post(self):
data_json = {"msgtype": "text",
"text": {"content": " 小夏 ?, 陈美什么时候回家 @15700091446"},
"at": {"atMobiles": ["17671653115", "15700091446"]}}
jdata = json.dumps(data_json)
req = urllib2.Request(self.url, jdata, self.headers)
response = urllib2.urlopen(req)
return response.read()
if name == “main”:
dingding = DingDing()
resp = dingding.http_post()
更多推荐
已为社区贡献3条内容
所有评论(0)