钉钉机器人
#!/usr/bin/env python-- coding:utf-8 --import urllib2import jsonclass DingDing(object):def init(self):self.url =#钉钉机器人链接self.headers = {‘Content-Type’: “application/json; charset=utf-8”, ‘Use...
·
#!/usr/bin/env python
-- coding:utf-8 --
import urllib2
import json
class DingDing(object):
def init(self):
self.url = #钉钉机器人链接
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, info):
data_json = {"msgtype": "text",
"text": {"content": " 亲 %s @176xxxx3115" % info},
"at": {"atMobiles": ["176xxxx3115"]}}
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()
info = ‘没有@到创建人员’
resp = dingding.http_post(info)
更多推荐
已为社区贡献3条内容
所有评论(0)