V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
yakczh
V2EX  ›  Python

pycurl 相比 requests 是不是效率要高一些?

  •  
  •   yakczh · Feb 21, 2014 · 4730 views
    This topic created in 4456 days ago, the information mentioned may be changed or developed.
    6 replies    1970-01-01 08:00:00 +08:00
    zhwei
        1
    zhwei  
       Feb 21, 2014
    pycurl是封装的curl, 效率要高点,但是requests更加人性化,更易用,如果用于爬虫的话推荐requests,毕竟效率可以通过多线程或者异步提高。
    piglei
        2
    piglei  
       Feb 21, 2014
    如楼上所说,“效率”这个东西到了网络库上来说,最大的问题是IO,所以库本身的执行效率来说并不是那么重要。和效率有关的指标还是IO相关的,比如这个库是不是支持keep-alive,是不是支持异步化等等等等。
    cute
        3
    cute  
       Feb 21, 2014   ❤️ 2
    搜索human_curl

    import human_curl
    r = human_curl.get('http://v2ex.com')

    requests不支持100 continue.
    wangfengmadking
        4
    wangfengmadking  
       Feb 21, 2014
    还有就是requests原生不支持socket5代理。。。
    pubby
        5
    pubby  
       Feb 21, 2014
    一直用gearman

    再用node写一个worker,支持socks5代理

    爬虫直接将抓取任务交给gearman,异步执行
    zhwei
        6
    zhwei  
       Feb 21, 2014
    @cute api和requests一样啊,好东西!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3449 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 00:09 · PVG 08:09 · LAX 17:09 · JFK 20:09
    ♥ Do have faith in what you're doing.