# -*- encoding: utf-8 -*-
import requests
import demjson

corpid = "ww************"
agentId = "1000004"
corpsecret = "cSTOdVnE3cfQWgs**************"

r = requests.get("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={}&corpsecret={}".format(corpid, corpsecret))
data = r.json()
access_token = data["access_token"]

data = {
    "touser": "@all",
    "msgtype": "text",
    "agentid": agentId,
    "text": {
        "content": "hello"
    }
}
data = demjson.encode(data)

r = requests.post("https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={}".format(access_token), data=data)
print(r.text)

标签: none

添加新评论