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
c
V2EX  ›  Python

推荐一个可以替代urllib2的Python库 requests

  •  
  •   c · 2011-11-24 23:21:09 +08:00 · 5437 次点击
    这是一个创建于 4554 天前的主题,其中的信息可能已经有所发展或是发生改变。
    0.8使用了urllib3,变动比较大,虽然现在还有很多问题,不过用起来非常不错哦。
    经常抓网页的可以考虑下,抓取效率有10%的提升。

    项目主页: http://python-requests.org
    Github: https://github.com/kennethreitz/requests
    4 条回复    1970-01-01 08:00:00 +08:00
    ayanamist
        1
    ayanamist  
       2011-11-25 10:38:33 +08:00
    urllib3使用的keep-alive方式可能会被某些网站屏蔽的。当时我就被Twitter的API给屏蔽了,永远返回404……
    c
        2
    c  
    OP
       2011-11-25 10:44:11 +08:00
    在Requests中可以设置keep-alive=False的
    phus
        3
    phus  
       2011-11-25 12:56:03 +08:00
    httplib2
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1515 人在线   最高记录 6547   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:08 · PVG 01:08 · LAX 10:08 · JFK 13:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.