V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
xueweihan
V2EX  ›  Python

Tornado HTTPClient 请求微博 api 403?

  •  
  •   xueweihan ·
    521xueweihan · 2015-12-16 11:52:07 +08:00 · 2667 次点击
    这是一个创建于 3055 天前的主题,其中的信息可能已经有所发展或是发生改变。
    'https://api.weibo.com/2/search/suggestions/users.json?' + urllib.urlencode({'source': 'appkey', 'q': '阿信'})
    请求的 api 如上,我直接用浏览器访问这个 url 可以返回数据,但是如果用 Tornado HTTPClient 请求就返回 403
    3 条回复    2015-12-24 12:34:25 +08:00
    dai269619118
        1
    dai269619118  
       2015-12-16 12:48:57 +08:00
    找个抓取 http 的工具 分别把 2 个 http 请求抓出来对比下 就知道了
    NeusoftGin
        2
    NeusoftGin  
       2015-12-16 21:40:07 +08:00
    上次一个也在搞微博 API 的盆友说 用浏览器成功用 postman 却失败
    结果原因是:浏览器登录了微博账户。。。。

    新浪微博自己的调试工具 http://open.weibo.com/tools/console
    xueweihan
        3
    xueweihan  
    OP
       2015-12-24 12:34:25 +08:00
    @NeusoftGin 您的意思我只带 appkey 请求不行,要先弄成认真登陆状态,搞到 cookie ?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1092 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:19 · PVG 02:19 · LAX 11:19 · JFK 14:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.