browser: Allow changing the Session class

In a separate method, so arguments can be removed or added.
This commit is contained in:
Laurent Bachelier 2015-04-03 12:46:14 +02:00 committed by Romain Bignon
commit 25da89642a

View file

@ -200,11 +200,14 @@ class Browser(object):
else:
self.logger.info(msg)
def _create_session(self):
return FuturesSession(max_workers=self.MAX_WORKERS, max_retries=self.MAX_RETRIES)
def _setup_session(self, profile):
"""
Set up a python-requests session for our usage.
"""
session = FuturesSession(max_workers=self.MAX_WORKERS, max_retries=self.MAX_RETRIES)
session = self._create_session()
session.proxies = self.PROXIES