Search code examples
pythongrequests

How to set grequests timeout


How would I accomplish the following:

rs = (self.exporter.grequester(url) for url in url_chunk)
res_items = grequests.map(rs, timeout=10s) # this is the item that times out

Solution

  • Try this:

    reqs = grequests.map(grequests.get(link, headers=header,  timeout=1) for link in links)
    

    source