对企业用户发送消息,显示系统繁忙
回1楼竹梅的帖子
嗯嗯,我是用python写的,这是添加部门,我所有post请求都返回这个错误。代码如下:
def http_post(url, data):
headers = {
'Content-Type': 'application/json',
'Accept-Charset': 'utf-8'
}
request = urllib2.Request(url, data, headers)
try:
response = urllib2.urlopen(request, timeout=10)
except urllib2.URLError, e:
logger.error(e)
result = json.loads(response.read())
if result.get('errcode') == 0:
result.pop('erroce')
result.pop('errmsg')
return result
else:
errcode = result.get('errcode')
errmsg = result.get('errmsg')
logger.error('Get url(%s) return error: %s | %s' % (url, errcode, errmsg))
return None
def create_department(access_token, name, parentid, order=1):
url = 'https://oapi.dingtalk.com/department/create?'
args = {
'access_token': access_token
}
url += urlencode(args)
data = {
'access_token': access_token,
'name': name,
'parentid': parentid,
'order': str(order)
}
return http_post(url, urlencode(data))
参数的格式跟文档上的一样的啊。是不是哪里出问题了
-------------------------
回1楼竹梅的帖子
我知道了,参数的错误,谢谢
赞0
踩0