def ewc_webhook(a, b, c): # 调用ewc的webhook,发送消息; a, b, c = a, b, c hook_addr = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=*************' http = urllib3.PoolManager() time = datetime.datetime.now() today = time.strftime('%Y-%m-%d')
data = { "msgtype": "markdown", "markdown": { "content": "<font color=\"info\">%s</font>\n\ >Blog总访问量:<font color=\"comment\">%s</font>\n\ >Blog访客数量:<font color=\"comment\">%s</font>\n\ >封面访问数:<font color=\"comment\">%s</font>" %(today, a, b, c) } } data = json.dumps(data).encode() response = http.request('POST', hook_addr, body=data)