Esempio n. 1
0
 def __init__(self, host, port=None, key_file=None, cert_file=None,
              cacert=None, timeout=None, insecure=False,
              ssl_compression=True):
     # List of exceptions reported by Python3 instead of
     # SSLConfigurationError
     if six.PY3:
         excp_lst = (TypeError, IOError, ssl.SSLError)
         # https.py:250:36: F821 undefined name 'FileNotFoundError'
     else:
         # NOTE(jamespage)
         # Accomodate changes in behaviour for pep-0467, introduced
         # in python 2.7.9.
         # https://github.com/python/peps/blob/master/pep-0476.txt
         excp_lst = (TypeError, IOError, ssl.SSLError)
     try:
         HTTPSConnection.__init__(self, host, port,
                                  key_file=key_file,
                                  cert_file=cert_file)
         self.key_file = key_file
         self.cert_file = cert_file
         self.timeout = timeout
         self.insecure = insecure
         # NOTE(flaper87): `is_verified` is needed for
         # requests' urllib3. If insecure is True then
         # the request is not `verified`, hence `not insecure`
         self.is_verified = not insecure
         self.ssl_compression = ssl_compression
         self.cacert = None if cacert is None else str(cacert)
         self.set_context()
         # ssl exceptions are reported in various form in Python 3
         # so to be compatible, we report the same kind as under
         # Python2
     except excp_lst as e:
         raise exc.SSLConfigurationError(str(e))
Esempio n. 2
0
 def __init__(self, host, port=None, key_file=None, cert_file=None,
              cacert=None, timeout=None, insecure=False,
              ssl_compression=True):
     # List of exceptions reported by Python3 instead of
     # SSLConfigurationError
     if six.PY3:
         excp_lst = (TypeError, FileNotFoundError, ssl.SSLError)
     else:
         # NOTE(jamespage)
         # Accommodate changes in behaviour for pep-0467, introduced
         # in python 2.7.9.
         # https://github.com/python/peps/blob/master/pep-0476.txt
         excp_lst = (TypeError, IOError, ssl.SSLError)
     try:
         HTTPSConnection.__init__(self, host, port,
                                  key_file=key_file,
                                  cert_file=cert_file)
         self.key_file = key_file
         self.cert_file = cert_file
         self.timeout = timeout
         self.insecure = insecure
         # NOTE(flaper87): `is_verified` is needed for
         # requests' urllib3. If insecure is True then
         # the request is not `verified`, hence `not insecure`
         self.is_verified = not insecure
         self.ssl_compression = ssl_compression
         self.cacert = None if cacert is None else str(cacert)
         self.set_context()
         # ssl exceptions are reported in various form in Python 3
         # so to be compatible, we report the same kind as under
         # Python2
     except excp_lst as e:
         raise exc.SSLConfigurationError(str(e))
Esempio n. 3
0
 def __init__(
     self,
     host,
     port=None,
     key_file=None,
     cert_file=None,
     cacert=None,
     timeout=None,
     insecure=False,
     ssl_compression=True,
 ):
     # List of exceptions reported by Python3 instead of
     # SSLConfigurationError
     if six.PY3:
         excp_lst = (TypeError, FileNotFoundError, ssl.SSLError)
     else:
         excp_lst = ()
     try:
         HTTPSConnection.__init__(self, host, port, key_file=key_file, cert_file=cert_file)
         self.key_file = key_file
         self.cert_file = cert_file
         self.timeout = timeout
         self.insecure = insecure
         self.ssl_compression = ssl_compression
         self.cacert = cacert
         self.setcontext()
         # ssl exceptions are reported in various form in Python 3
         # so to be compatible, we report the same kind as under
         # Python2
     except excp_lst as e:
         raise exc.SSLConfigurationError(str(e))
Esempio n. 4
0
 def __init__(self,
              host,
              port=None,
              key_file=None,
              cert_file=None,
              cacert=None,
              timeout=None,
              insecure=False,
              ssl_compression=True):
     # List of exceptions reported by Python3 instead of
     # SSLConfigurationError
     excp_lst = (TypeError, FileNotFoundError, ssl.SSLError)
     try:
         HTTPSConnection.__init__(self,
                                  host,
                                  port,
                                  key_file=key_file,
                                  cert_file=cert_file)
         self.key_file = key_file
         self.cert_file = cert_file
         self.timeout = timeout
         self.insecure = insecure
         # NOTE(flaper87): `is_verified` is needed for
         # requests' urllib3. If insecure is True then
         # the request is not `verified`, hence `not insecure`
         self.is_verified = not insecure
         self.ssl_compression = ssl_compression
         self.cacert = None if cacert is None else str(cacert)
         self.set_context()
         # ssl exceptions are reported in various form in Python 3
         # so to be compatible, we report the same kind as under
         # Python2
     except excp_lst as e:
         raise exc.SSLConfigurationError(str(e))
Esempio n. 5
0
 def __init__(self, host, port=None, key_file=None, cert_file=None,
              cacert=None, timeout=None, insecure=False,
              ssl_compression=True):
     # List of exceptions reported by Python3 instead of
     # SSLConfigurationError
     if six.PY3:
         excp_lst = (TypeError, FileNotFoundError, ssl.SSLError)
     else:
         excp_lst = ()
     try:
         HTTPSConnection.__init__(self, host, port,
                                  key_file=key_file,
                                  cert_file=cert_file)
         self.key_file = key_file
         self.cert_file = cert_file
         self.timeout = timeout
         self.insecure = insecure
         self.ssl_compression = ssl_compression
         self.cacert = None if cacert is None else str(cacert)
         self.set_context()
         # ssl exceptions are reported in various form in Python 3
         # so to be compatible, we report the same kind as under
         # Python2
     except excp_lst as e:
         raise exc.SSLConfigurationError(str(e))
Esempio n. 6
0
 def __init__(
     self,
     host,
     port=None,
     key_file=None,
     cert_file=None,
     cacert=None,
     timeout=None,
     insecure=False,
     ssl_compression=True,
 ):
     # List of exceptions reported by Python3 instead of
     # SSLConfigurationError
     if six.PY3:
         excp_lst = (TypeError, FileNotFoundError, ssl.SSLError)
     else:
         excp_lst = ()
     try:
         HTTPSConnection.__init__(self, host, port, key_file=key_file, cert_file=cert_file)
         self.key_file = key_file
         self.cert_file = cert_file
         self.timeout = timeout
         self.insecure = insecure
         # NOTE(flaper87): `is_verified` is needed for
         # requests' urllib3. If insecure is True then
         # the request is not `verified`, hence `not insecure`
         self.is_verified = not insecure
         self.ssl_compression = ssl_compression
         self.cacert = None if cacert is None else str(cacert)
         self.set_context()
         # ssl exceptions are reported in various form in Python 3
         # so to be compatible, we report the same kind as under
         # Python2
     except excp_lst as e:
         raise exc.SSLConfigurationError(str(e))
Esempio n. 7
0
 def __init__(self, host, port=None, key_file=None, cert_file=None,
              cacert=None, timeout=None, insecure=False,
              ssl_compression=True):
     HTTPSConnection.__init__(self, host, port,
                              key_file=key_file,
                              cert_file=cert_file)
     self.key_file = key_file
     self.cert_file = cert_file
     self.timeout = timeout
     self.insecure = insecure
     self.ssl_compression = ssl_compression
     self.cacert = cacert
     self.setcontext()
Esempio n. 8
0
 def __init__(self, host, port=None, key_file=None, cert_file=None,
              cacert=None, timeout=None, insecure=False,
              ssl_compression=True):
     HTTPSConnection.__init__(self, host, port,
                              key_file=key_file,
                              cert_file=cert_file)
     self.key_file = key_file
     self.cert_file = cert_file
     self.timeout = timeout
     self.insecure = insecure
     self.ssl_compression = ssl_compression
     self.cacert = cacert
     self.setcontext()