V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ldming
V2EX  ›  问与答

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

  •  
  •   ldming · Apr 13, 2018 · 1304 views
    This topic created in 2939 days ago, the information mentioned may be changed or developed.
    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  
       Apr 13, 2018   ❤️ 1
    建议先学好英语。Menber 是什么?

    url2 地址不对,自己回去看文档去!
    ldming
        2
    ldming  
    OP
       Apr 13, 2018
    @julyclyde 感谢大佬
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   804 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 21:45 · PVG 05:45 · LAX 14:45 · JFK 17:45
    ♥ Do have faith in what you're doing.