V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ldming
V2EX  ›  问与答

请教各位大佬,企业微信是不是禁止 Python 的 post 功能

  •  
  •   ldming · 2018-04-13 09:29:51 +08:00 · 1033 次点击
    这是一个创建于 2361 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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,求教各位大佬
    julyclyde
        1
    julyclyde  
       2018-04-13 10:42:17 +08:00   ❤️ 1
    建议先学好英语。Menber 是什么?

    url2 地址不对,自己回去看文档去!
    ldming
        2
    ldming  
    OP
       2018-04-13 15:59:27 +08:00
    @julyclyde 感谢大佬
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   961 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:30 · PVG 03:30 · LAX 12:30 · JFK 15:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.