corpid = 'ww8978c479ac0e6027' corpsecret = 'pq_50kNuSRYDUrTyfzjTSmn_8i6aibbvGCDFs8Vh-ns' url = f'https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpid}&corpsecret={corpsecret}' r = requests.get(url) token = r.json().get('access_token') print(token)
data = {
"tagname": "KAI",
"tagid": 16
}
r = requests.post(f'https://qyapi.weixin.qq.com/cgi-bin/tag/create?access_token={token}', json=data)
print(r.json())
assert r.json().get('errmsg') == 'created'