how enable requests async mode?

后端 未结 5 1551
名媛妹妹
名媛妹妹 2020-12-04 18:40

for this code:

import sys

import gevent
from gevent import monkey

monkey.patch_all()

import requests
import urllib2

def worker(url, use_urllib2=False):
          


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 18:43

    From the requests doc Blocking Or Non-Blocking:

    If you are concerned about the use of blocking IO, 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.

提交回复
热议问题