url2='https://qyapi.weixin.qq.com/cgi-bin/create?access_token=%s'%(CDCtoken)
url3='https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=%s&userid=ldming'%(CDCtoken)
values={"userid":"zhangsan",
"name":"哈哈哈",
"english_name":"jackzhang",
"mobile":"15913215421",
"department":[1,2],
"order":[10,40],
"position":"无敌",
"gender":"1",
"email":"
[email protected]",
"isleader":1,
"enable":1,
"avatar_mediaid":"2-G6nrLmr5EC3MNb_-zL1dDdzkd0p7cNliYu9V5w7o8K0",
"telephone":"020-123456",
"extattr":{"attrs":[{"name":"无敌","value":"无敌"},{"name":"无敌","value":"1234567234"}]},}
#newMenber=json.dumps(values).encode(encoding='utf-8')
newMenber=json.dumps(values,ensure_ascii=True).encode(encoding='utf-8')
#send_request=urllib.request.urlopen(url2,newMenber)
#response=json.loads(urllib.request(send_request).read())
Req=urllib.request.urlopen(url2,newMenber)
Requtf=Req.read().decode('utf-8')
print(Requtf)
File "weixin.py", line 42, in <module>
Req=urllib.request.urlopen(url2,newMenber)
File "C:\Users\yanqiong\AppData\Local\Programs\Python\Python35\lib\urllib\requ
est.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\yanqiong\AppData\Local\Programs\Python\Python35\lib\urllib\requ
est.py", line 472, in open
response = meth(req, response)
File "C:\Users\yanqiong\AppData\Local\Programs\Python\Python35\lib\urllib\requ
est.py", line 582, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Users\yanqiong\AppData\Local\Programs\Python\Python35\lib\urllib\requ
est.py", line 510, in error
return self._call_chain(*args)
File "C:\Users\yanqiong\AppData\Local\Programs\Python\Python35\lib\urllib\requ
est.py", line 444, in _call_chain
result = func(*args)
File "C:\Users\yanqiong\AppData\Local\Programs\Python\Python35\lib\urllib\requ
est.py", line 590, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
跑脚本后报 404,求教各位大佬