當前位置: 首頁>>代碼示例>>Python>>正文


Python ssl.OPENSSL_VERSION_NUMBER屬性代碼示例

本文整理匯總了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() 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:23,代碼來源:inject_securetransport.py

示例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() 
開發者ID:pypa,項目名稱:pipenv,代碼行數:23,代碼來源:inject_securetransport.py

示例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) 
開發者ID:PaloAltoNetworks,項目名稱:terraform-templates,代碼行數:14,代碼來源:xapi.py

示例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) 
開發者ID:pavlodvornikov,項目名稱:aiocfscrape,代碼行數:15,代碼來源:__init__.py

示例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,
        },
    } 
開發者ID:danielecook,項目名稱:gist-alfred,代碼行數:54,代碼來源:help.py

示例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,
        },
    } 
開發者ID:kuhnertdm,項目名稱:wow-addon-updater,代碼行數:47,代碼來源:help.py


注:本文中的ssl.OPENSSL_VERSION_NUMBER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。