give max_retries to FuturesSession in case it may build HTTPAdaptors
This commit is contained in:
parent
a9b86d60a5
commit
195b61fb57
2 changed files with 4 additions and 3 deletions
|
|
@ -196,7 +196,7 @@ class Browser(object):
|
|||
"""
|
||||
Set up a python-requests session for our usage.
|
||||
"""
|
||||
session = FuturesSession(max_workers=self.MAX_WORKERS)
|
||||
session = FuturesSession(max_workers=self.MAX_WORKERS, max_retries=self.MAX_RETRIES)
|
||||
|
||||
session.proxies = self.PROXIES
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class WeboobSession(Session):
|
|||
|
||||
|
||||
class FuturesSession(WeboobSession):
|
||||
def __init__(self, executor=None, max_workers=2, *args, **kwargs):
|
||||
def __init__(self, executor=None, max_workers=2, max_retries=2, *args, **kwargs):
|
||||
"""Creates a FuturesSession
|
||||
|
||||
Notes
|
||||
|
|
@ -119,7 +119,8 @@ class FuturesSession(WeboobSession):
|
|||
# set connection pool size equal to max_workers if needed
|
||||
if max_workers > DEFAULT_POOLSIZE:
|
||||
adapter_kwargs = dict(pool_connections=max_workers,
|
||||
pool_maxsize=max_workers)
|
||||
pool_maxsize=max_workers,
|
||||
max_retries=max_retries)
|
||||
self.mount('https://', HTTPAdapter(**adapter_kwargs))
|
||||
self.mount('http://', HTTPAdapter(**adapter_kwargs))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue