本文整理汇总了Python中eventlet.green.httplib.HTTPSConnection.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPSConnection.__init__方法的具体用法?Python HTTPSConnection.__init__怎么用?Python HTTPSConnection.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eventlet.green.httplib.HTTPSConnection
的用法示例。
在下文中一共展示了HTTPSConnection.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from eventlet.green.httplib import HTTPSConnection [as 别名]
# 或者: from eventlet.green.httplib.HTTPSConnection import __init__ [as 别名]
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))
示例2: __init__
# 需要导入模块: from eventlet.green.httplib import HTTPSConnection [as 别名]
# 或者: from eventlet.green.httplib.HTTPSConnection import __init__ [as 别名]
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))
示例3: __init__
# 需要导入模块: from eventlet.green.httplib import HTTPSConnection [as 别名]
# 或者: from eventlet.green.httplib.HTTPSConnection import __init__ [as 别名]
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))
示例4: __init__
# 需要导入模块: from eventlet.green.httplib import HTTPSConnection [as 别名]
# 或者: from eventlet.green.httplib.HTTPSConnection import __init__ [as 别名]
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()