#-*- coding=utf-8 -*-
#-*- encoding:utf-8 -*-
import json
import requests
def send_wechat_robot(
body = "",
keyid = ""):
request_url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=%s" % keyid
datas = {
"msgtype": "text",
"text": {"content": body}
}
http_headers = {"Content-Type": "application/json"}
request_datas = json.dumps(datas, ensure_ascii = False)
req = requests.post(
url = request_url,
data = request_datas,
headers = http_headers,
timeout = 10
)
req.close()
网友评论