我用 Python 来处理钉钉的服务器端接口
现在遇到一个问题,申请 token 后,get 请求都是能用的,post 数据就会报 500 错误
之前发的接口数据字段多,怕参数哪里写的不对,于是使用了(获取用户待审批数量)接口测试找原因,这个接口只需要传递一个 userid
https://open-doc.dingtalk.com/microapp/serverapi2/ui5305
access_token = "xxxxxxxxxx"
url = 'https://oapi.dingtalk.com/topapi/process/gettodonum?access_token=%s' % access_token
data = {
"userid": "manager4012"
}
headers = {
'Content-Type': 'application/json'
}
r = requests.post(url, data=json.dumps(data), headers=headers)
print(r.text)
报错:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>500 Internal Server Error</title></head>
<body bgcolor="white"><script>
with(document)with(body)with(insertBefore(createElement("script"),firstChild))setAttribute("exparams","category=&userid=&aplus&yunid=&asid=AQAACADXmhdb3r3FKQAACACKRiLMGAxPpg==",id="tb-beacon-aplus",src="//g.alicdn.com/alilog/mlog/aplus_v2.js")
</script>
<h1>500 Internal Server Error</h1>
<p>The server encountered an internal error or misconfiguration and was unable to complete your request.</body>
headers utf-8 也指定了,json 字符串也转换了
纠结一两天,文档,demo 找了不少,很是不能理解一个 post 过去直接 500 错误,没思路了,特来求助
