本文整理匯總了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,
},
}