Is it possible to set the maximum number of attempts shared between all pool connections in one session?

I am currently doing the following to set the maximum number of connection attempts for my shell grequest:

self._s = Session()
retries = Retry(total=5, status_forcelist=[500, 502, 503, 504])
self._s.mount('http://, HTTPAdapter(max_retries=retries))

Then I create a bunch of objects grequestwith a session self._sas one of the arguments. For exmaple, the creation of a set of queries GETwill be performed using the following:

requests = [grequests.get(url, ..., 'session': self._s')]

Finally, they all end up being issued with help grequests.map(requests, ...).

The problem is that I want the maximum number of retries to be maintained and shared by all connections in the connection pool. Repetitions still seem to apply only based on an individual connection. Is there any way to do this? Is this not possible, since new objects Retry()seem to be created with every decrease from common calls?

+6
source share
1 answer

I think you're out of luck. Retrydocstring says (excerpt):

Each retry attempt will create a new Retry object with updated values, so they can be safely reused.

, , , ... .

, Retry - , : . , Retry . . urllib.utils.retry , .

0

All Articles