推荐学习书目
› 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 · 8273 views
    This topic created in 3515 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
    crytis
    Mar 31, 2017 via iPhone
    1
    真的吗
    hihihihihi
    hihihihihi
    Mar 31, 2017
    2
    谁说不支持? 我用的好好的。。
    hihihihihi
    hihihihihi
    Mar 31, 2017❤️1
    3
    你们这些年轻人不要总想搞个大新闻
    hippoboy
    hippoboy
    Mar 31, 2017
    4
    好象是的?
    tonghuashuai
    tonghuashuai
    Mar 31, 2017
    5
    那我用的是假的 gevent 的吗?
    fuxkcsdn
    fuxkcsdn
    Mar 31, 2017
    7
    6 楼+1
    TKKONE
    TKKONE
    PRO
    Mar 31, 2017 via Android
    8
    grequests
    simple2025
    simple2025
    OP
    Apr 1, 2017 via iPhone
    9
    @4ever911 你看下到底有没有省时间
    AgentK
    AgentK
    Apr 1, 2017
    10
    @chenqh 亲测节省了
    hihihihihi
    hihihihihi
    Apr 1, 2017
    11
    @chenqh 兄臺,你肯定是使用不對。 3000 多 URL ,我 10 來秒就搞定了,下載保存的文件有接近 100MB ,你說省時間沒有。

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