there are lots of projects out there that combine Requests with one of
Python’s asynchronicity frameworks. Two excellent examples are
grequests and requests-futures.
import eventlet
eventlet.monkey_patch() # must execute as early as possible
...
# everything is non-blocking now:
import requests, amqp, memcache, paramiko, redis
从docs:
对于eventlet,您可以使用erequests。
使用eventletmonkey patching使任何纯python库不阻塞。
修补单个库
可以将包erequests和grequests拆分为这两行。
修补所有内容
更新:有带猴子修补请求库的known issue。如果你得到:
,然后将导入行修改为
相关问题 更多 >
编程相关推荐