当前位置: 首页>>代码示例>>Python>>正文


Python ssl.OPENSSL_VERSION_INFO属性代码示例

本文整理汇总了Python中ssl.OPENSSL_VERSION_INFO属性的典型用法代码示例。如果您正苦于以下问题:Python ssl.OPENSSL_VERSION_INFO属性的具体用法?Python ssl.OPENSSL_VERSION_INFO怎么用?Python ssl.OPENSSL_VERSION_INFO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ssl的用法示例。


在下文中一共展示了ssl.OPENSSL_VERSION_INFO属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_openssl_supports_tls_version_1_2

# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_INFO [as 别名]
def check_openssl_supports_tls_version_1_2(**kwargs):
    import ssl
    try:
        openssl_version_tuple = ssl.OPENSSL_VERSION_INFO
        if openssl_version_tuple[0] < 1 or openssl_version_tuple[2] < 1:
            warnings.warn(
                'Currently installed openssl version: %s does not '
                'support TLS 1.2, which is required for use of iot-data. '
                'Please use python installed with openssl version 1.0.1 or '
                'higher.' % (ssl.OPENSSL_VERSION),
                UnsupportedTLSVersionWarning
            )
    # We cannot check the openssl version on python2.6, so we should just
    # pass on this conveniency check.
    except AttributeError:
        pass 
开发者ID:skarlekar,项目名称:faces,代码行数:18,代码来源:handlers.py

示例2: check_openssl_supports_tls_version_1_2

# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_INFO [as 别名]
def check_openssl_supports_tls_version_1_2(**kwargs):
    import ssl
    try:
        openssl_version_tuple = ssl.OPENSSL_VERSION_INFO
        if openssl_version_tuple < (1, 0, 1):
            warnings.warn(
                'Currently installed openssl version: %s does not '
                'support TLS 1.2, which is required for use of iot-data. '
                'Please use python installed with openssl version 1.0.1 or '
                'higher.' % (ssl.OPENSSL_VERSION),
                UnsupportedTLSVersionWarning
            )
    # We cannot check the openssl version on python2.6, so we should just
    # pass on this conveniency check.
    except AttributeError:
        pass 
开发者ID:QData,项目名称:deepWordBug,代码行数:18,代码来源:handlers.py

示例3: __connect

# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_INFO [as 别名]
def __connect(self):
        err = self.__socket.connect_ex((self.__host, self.__port))
        if not err:
            self.__connect_ok = True
            if self.__ssl_on:
                self.__tls_ctx = ssl._create_unverified_context()

                ssl_verinfo = ssl.OPENSSL_VERSION_INFO
                # 只有openssl 1.0.2版本及其以上才支持ALPN
                if ssl_verinfo[0] >= 1 and ssl_verinfo[1] >= 0 and ssl_verinfo[2] >= 2:
                    self.__alpn_on = True

                if self.__alpn_on:
                    alpn_protocols = ["http/1.1"]
                    self.__tls_ctx.set_alpn_protocols(alpn_protocols)
                self.__socket = self.__tls_ctx.wrap_socket(self.__socket)
            self.__socket.setblocking(0)
        return 
开发者ID:fdslight,项目名称:fdslight,代码行数:20,代码来源:httpclient.py

示例4: _certifi_where_for_ssl_version

# 需要导入模块: import ssl [as 别名]
# 或者: from ssl import OPENSSL_VERSION_INFO [as 别名]
def _certifi_where_for_ssl_version():
    """Gets the right location for certifi certifications for the current SSL
    version.

    Older versions of SSL don't support the stronger set of root certificates.
    """
    if not ssl:
        return

    if ssl.OPENSSL_VERSION_INFO < (1, 0, 2):
        warnings.warn(
            'You are using an outdated version of OpenSSL that '
            'can\'t use stronger root certificates.')
        return certifi.old_where()

    return certifi.where() 
开发者ID:GoogleCloudPlatform,项目名称:httplib2shim,代码行数:18,代码来源:__init__.py


注:本文中的ssl.OPENSSL_VERSION_INFO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。