예제 #1
0
 def __init__(self):
   super(RequestsLibEngine, self).__init__()
   self.session = requests.Session()
   # Configure session.
   self.session.trust_env = False
   self.session.verify = tools.get_cacerts_bundle()
   # Configure connection pools.
   for protocol in ('https://', 'http://'):
     self.session.mount(protocol, adapters.HTTPAdapter(
         pool_connections=64,
         pool_maxsize=64,
         max_retries=0,
         pool_block=False))
예제 #2
0
 def __init__(self, ca_certs):
     super(RequestsLibEngine, self).__init__()
     self.session = requests.Session()
     # Configure session.
     self.session.trust_env = False
     self.session.verify = ca_certs
     # Configure connection pools.
     for protocol in ('https://', 'http://'):
         self.session.mount(
             protocol,
             adapters.HTTPAdapter(
                 pool_connections=self.CONNECTION_POOL_SIZE,
                 pool_maxsize=self.CONNECTION_POOL_SIZE,
                 max_retries=self.CONNECTION_RETRIES,
                 pool_block=self.CONNECTION_POOL_BLOCK))