本文整理汇总了Python中ssl.OPENSSL_VERSION_NUMBER属性的典型用法代码示例。如果您正苦于以下问题:Python ssl.OPENSSL_VERSION_NUMBER属性的具体用法?Python ssl.OPENSSL_VERSION_NUMBER怎么用?Python ssl.OPENSSL_VERSION_NUMBER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ssl
的用法示例。
在下文中一共展示了ssl.OPENSSL_VERSION_NUMBER属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: inject_securetransport
# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_NUMBER [as 别名]
def inject_securetransport():
# type: () -> None
# Only relevant on macOS
if sys.platform != "darwin":
return
try:
import ssl
except ImportError:
return
# Checks for OpenSSL 1.0.1
if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100f:
return
try:
from pip._vendor.urllib3.contrib import securetransport
except (ImportError, OSError):
return
securetransport.inject_into_urllib3()
示例2: inject_securetransport
# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_NUMBER [as 别名]
def inject_securetransport():
# type: () -> None
# Only relevant on macOS
if sys.platform != "darwin":
return
try:
import ssl
except ImportError:
return
# Checks for OpenSSL 1.0.1
if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100f:
return
try:
from pipenv.patched.notpip._vendor.urllib3.contrib import securetransport
except (ImportError, OSError):
return
securetransport.inject_into_urllib3()
示例3: _rome_warning
# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_NUMBER [as 别名]
def _rome_warning(self, reason):
# "Connection reset by peer" or
# "EOF occurred in violation of protocol"
# may indicate no TLS 1.[12]
if (('Errno 54' in reason or
'EOF occurred in violation of protocol' in reason) and
hasattr(ssl, 'OPENSSL_VERSION_NUMBER') and
ssl.OPENSSL_VERSION_NUMBER < 0x1000100):
x = 'WARNING: Your SSL (%s) may not support TLS 1.1.' % \
ssl.OPENSSL_VERSION
x += ' PAN-OS 8.0 does not allow TLS 1.0 connections by default.'
self._log(DEBUG1, x)
示例4: handle_captcha_challenge
# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_NUMBER [as 别名]
def handle_captcha_challenge(self, resp, url):
error = (
'Cloudflare captcha challenge presented for %s (cfscrape cannot solve captchas)'
% urlparse(url).netloc
)
if ssl.OPENSSL_VERSION_NUMBER < 0x10101000:
error += '. Your OpenSSL version is lower than 1.1.1. Please upgrade your OpenSSL library and recompile Python.'
raise CloudflareCaptchaError(resp.request_info,
history=(),
status=resp.status,
message=error,
headers=resp.headers)
示例5: info
# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_NUMBER [as 别名]
def info():
"""Generate information for a bug report."""
try:
platform_info = {
'system': platform.system(),
'release': platform.release(),
}
except IOError:
platform_info = {
'system': 'Unknown',
'release': 'Unknown',
}
implementation_info = _implementation()
urllib3_info = {'version': urllib3.__version__}
chardet_info = {'version': chardet.__version__}
pyopenssl_info = {
'version': None,
'openssl_version': '',
}
if OpenSSL:
pyopenssl_info = {
'version': OpenSSL.__version__,
'openssl_version': '%x' % OpenSSL.SSL.OPENSSL_VERSION_NUMBER,
}
cryptography_info = {
'version': getattr(cryptography, '__version__', ''),
}
idna_info = {
'version': getattr(idna, '__version__', ''),
}
system_ssl = ssl.OPENSSL_VERSION_NUMBER
system_ssl_info = {
'version': '%x' % system_ssl if system_ssl is not None else ''
}
return {
'platform': platform_info,
'implementation': implementation_info,
'system_ssl': system_ssl_info,
'using_pyopenssl': pyopenssl is not None,
'pyOpenSSL': pyopenssl_info,
'urllib3': urllib3_info,
'chardet': chardet_info,
'cryptography': cryptography_info,
'idna': idna_info,
'requests': {
'version': requests_version,
},
}
示例6: info
# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_NUMBER [as 别名]
def info():
"""Generate information for a bug report."""
try:
platform_info = {
'system': platform.system(),
'release': platform.release(),
}
except IOError:
platform_info = {
'system': 'Unknown',
'release': 'Unknown',
}
implementation_info = _implementation()
urllib3_info = {'version': urllib3.__version__}
chardet_info = {'version': chardet.__version__}
pyopenssl_info = {
'version': None,
'openssl_version': '',
}
if OpenSSL:
pyopenssl_info = {
'version': OpenSSL.__version__,
'openssl_version': '%x' % OpenSSL.SSL.OPENSSL_VERSION_NUMBER,
}
cryptography_info = {
'version': getattr(cryptography, '__version__', ''),
}
return {
'platform': platform_info,
'implementation': implementation_info,
'system_ssl': {
'version': '%x' % ssl.OPENSSL_VERSION_NUMBER,
},
'using_pyopenssl': pyopenssl is not None,
'pyOpenSSL': pyopenssl_info,
'urllib3': urllib3_info,
'chardet': chardet_info,
'cryptography': cryptography_info,
'requests': {
'version': requests_version,
},
}