推荐学习书目
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
simple2025
0D
V2EX  ›  Python

今天才知道 gevent 不支持 requests 库

  •  
  •   simple2025 · Mar 31, 2017 · 7919 views
    This topic created in 3364 days ago, the information mentioned may be changed or developed.

    此该我的心情只能用 。。。。

    Supplement 1  ·  Apr 1, 2017
    当然你们可能不信,那么我就举个例子吧,用 gevent 调用 requests 并行访问谷歌,设置超时为 1S ,如果是 10 个并 行
    ,你们觉得时间应该是多少?
    Supplement 2  ·  Apr 1, 2017
    我的锅。。
    是我不应该 tornado+request+gevent
    tornado 就应该用 AsyncHTTPClient
    19 replies    2017-04-12 19:05:59 +08:00
    crytis
        1
    crytis  
       Mar 31, 2017 via iPhone
    真的吗
    hihihihihi
        2
    hihihihihi  
       Mar 31, 2017
    谁说不支持? 我用的好好的。。
    hihihihihi
        3
    hihihihihi  
       Mar 31, 2017   ❤️ 1
    你们这些年轻人不要总想搞个大新闻
    hippoboy
        4
    hippoboy  
       Mar 31, 2017
    好象是的?
    tonghuashuai
        5
    tonghuashuai  
       Mar 31, 2017
    那我用的是假的 gevent 的吗?
    eclipselu
        6
    eclipselu  
       Mar 31, 2017   ❤️ 1
    fuxkcsdn
        7
    fuxkcsdn  
       Mar 31, 2017
    6 楼+1
    TKKONE
        8
    TKKONE  
    PRO
       Mar 31, 2017 via Android
    grequests
    simple2025
        9
    simple2025  
    OP
       Apr 1, 2017 via iPhone
    @4ever911 你看下到底有没有省时间
    AgentK
        10
    AgentK  
       Apr 1, 2017
    @chenqh 亲测节省了
    hihihihihi
        11
    hihihihihi  
       Apr 1, 2017
    @chenqh 兄臺,你肯定是使用不對。 3000 多 URL ,我 10 來秒就搞定了,下載保存的文件有接近 100MB ,你說省時間沒有。

    你打開方式不對啊。。。另外,注意複用 session 也能省不少時間。
    hihihihihi
        12
    hihihihihi  
       Apr 1, 2017
    關鍵字 session , adapter , Pool , monkeypatch
    AgentK
        13
    AgentK  
       Apr 1, 2017
    @4ever911 adapter/adaptor 是啥?
    simple2025
        14
    simple2025  
    OP
       Apr 1, 2017 via iPhone
    @4ever911 你代码怎么写的?
    neoblackcap
        15
    neoblackcap  
       Apr 1, 2017   ❤️ 1
    访问 google ?我司应该几十毫秒吧。
    不要总想着在愚人节搞个大新闻,你不 monkeypatch 又有多少程序能支持 gevent 啊。楼主你啊, too youny too simple, sometime naive 。还是要学习一个的。
    simple2025
        16
    simple2025  
    OP
       Apr 1, 2017
    @neoblackcap 我説的是 gevent.joinall 啊,如果他能并发,你説有多少呢?
    neoblackcap
        17
    neoblackcap  
       Apr 1, 2017
    @chenqh gevent.joinall 只是等待所有请求啊?为什么就不能并发呢?搞不懂
    neoblackcap
        18
    neoblackcap  
       Apr 1, 2017
    不要整天搞个大新闻,问问题就应该将你的最小可重复执行环境给贴出来
    ElfenSterben
        19
    ElfenSterben  
       Apr 12, 2017
    gevent 不是协程库么????
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1106 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 23:03 · PVG 07:03 · LAX 16:03 · JFK 19:03
    ♥ Do have faith in what you're doing.