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


Python urllib3.__version__方法代码示例

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


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

示例1: systemInfo

# 需要导入模块: import urllib3 [as 别名]
# 或者: from urllib3 import __version__ [as 别名]
def systemInfo():
    try:
        platform_info = {
            'system': platform.system(),
            'release': platform.release(),
        }
    except IOError:
        platform_info = {
            'system': 'Unknown',
            'release': 'Unknown',
        }

    return OrderedDict([
        ('platform', platform_info),
        ('interpreter', _pythonVersion()),
        ('cloudscraper', cloudscraper_version),
        ('requests', requests.__version__),
        ('urllib3', urllib3.__version__),
        ('OpenSSL', OrderedDict(
            [
                ('version', ssl.OPENSSL_VERSION),
                ('ciphers', getPossibleCiphers())
            ]
        ))
    ])

# ------------------------------------------------------------------------------- # 
开发者ID:a4k-openproject,项目名称:a4kScrapers,代码行数:29,代码来源:help.py

示例2: _urllib3_fix_filenames

# 需要导入模块: import urllib3 [as 别名]
# 或者: from urllib3 import __version__ [as 别名]
def _urllib3_fix_filenames(kwargs):
    """
    Remove non-ASCII characters from file names due to a limitation of the combination of
    urllib3 (via python-requests) and our server
    https://github.com/requests/requests/issues/2117
    Internal Ticket #3090
    """

    import urllib3

    # fixed in urllib3 1.25.2
    # https://github.com/urllib3/urllib3/pull/1492
    try:
        urllib_version = [int(p) for p in urllib3.__version__.split(".")]
    except Exception:
        print("Error parsing urllib version: " + urllib3.__version__, file=sys.stderr)
        return

    if urllib_version >= [1, 25, 2]:
        return

    if "files" in kwargs and kwargs["files"] is not None:
        acceptable_chars = "0123456789" + "abcdefghijklmnopqrstuvwxyz" + \
                           "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + " _-.,()[]{}"
        for param_name, fp in kwargs["files"].items():
            if isinstance(fp, (tuple, list)):
                filename, fp = fp
            else:
                filename = requests.utils.guess_filename(fp) or param_name

            def encode(char):
                try:
                    if char in acceptable_chars:
                        return char
                except UnicodeDecodeError:
                    pass
                return "x{:02x}".format(ord(char))
            filename = "".join(encode(x) for x in filename)

            kwargs["files"][param_name] = (filename, fp) 
开发者ID:joesecurity,项目名称:jbxapi,代码行数:42,代码来源:jbxapi.py

示例3: print_ver_info

# 需要导入模块: import urllib3 [as 别名]
# 或者: from urllib3 import __version__ [as 别名]
def print_ver_info():
    print('python-telegram-bot {0}'.format(telegram_ver))
    print('urllib3 {0}'.format(urllib3.__version__))
    print('certifi {0}'.format(certifi.__version__))
    print('future {0}'.format(future.__version__))
    print('Python {0}'.format(sys.version.replace('\n', ' '))) 
开发者ID:gorgiaxx,项目名称:qprotocal,代码行数:8,代码来源:__main__.py

示例4: __init__

# 需要导入模块: import urllib3 [as 别名]
# 或者: from urllib3 import __version__ [as 别名]
def __init__(self, token, endpoint=constants.DEFAULT_STREAM_ENDPOINT,
                 timeout=constants.DEFAULT_TIMEOUT, compress=True,
                 proxy_url=None):
        super(SSETransport, self).__init__(token, endpoint, timeout)
        pool_args = {
            'url': self._endpoint,
            'headers': {
                'Content-Type': 'text/plain',
                'X-SF-Token': self._token,
                'User-Agent': '{} urllib3/{}'.format(version.user_agent,
                                                     urllib3.__version__)
            },
            'timeout': urllib3.Timeout(connect=self._timeout, read=None),
        }

        if urllib3.util.parse_url(self._endpoint).scheme == 'https':
            pool_args.update({
                'cert_reqs': 'CERT_REQUIRED',  # Force certificate check.
                'ca_certs': certifi.where()    # Path to the Certifi bundle.
            })

        if proxy_url:
            proxy_manager = urllib3.poolmanager.proxy_from_url(proxy_url)
            endpoint = pool_args.pop('url')
            self._http = proxy_manager.connection_from_url(
                    endpoint, pool_kwargs=pool_args)
        else:
            self._http = urllib3.connectionpool.connection_from_url(
                    **pool_args) 
开发者ID:signalfx,项目名称:signalfx-python,代码行数:31,代码来源:sse.py

示例5: info

# 需要导入模块: import urllib3 [as 别名]
# 或者: from urllib3 import __version__ [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 urllib3 [as 别名]
# 或者: from urllib3 import __version__ [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__', ''),
    }

    # OPENSSL_VERSION_NUMBER doesn't exist in the Python 2.6 ssl module.
    system_ssl = getattr(ssl, 'OPENSSL_VERSION_NUMBER', None)
    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:MarcelloLins,项目名称:ServerlessCrawler-VancouverRealState,代码行数:55,代码来源:help.py

示例7: info

# 需要导入模块: import urllib3 [as 别名]
# 或者: from urllib3 import __version__ [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

示例8: __init__

# 需要导入模块: import urllib3 [as 别名]
# 或者: from urllib3 import __version__ [as 别名]
def __init__(self, apikey=None, apiurl=None, accept_tac=None,
                       timeout=None, verify_ssl=True, retries=3,
                       proxies=None, user_agent=None):
        """
        Create a JoeSandbox object.

        Parameters:
          apikey:     the api key
          apiurl:     the api url
          accept_tac: Joe Sandbox Cloud requires accepting the Terms and Conditions.
                      https://jbxcloud.joesecurity.org/resources/termsandconditions.pdf
          timeout:    Timeout in seconds for accessing the API. Raises a ConnectionError on timeout.
          verify_ssl: Enable or disable checking SSL certificates.
          retries:    Number of times requests should be retried if they timeout.
          proxies:    Proxy settings, see the requests library for more information:
                      http://docs.python-requests.org/en/master/user/advanced/#proxies
          user_agent: The user agent. Use this when you write an integration with Joe Sandbox
                      so that it is possible to track how often an integration is being used.
        """

        if apikey is None:
            apikey = os.environ.get("JBX_API_KEY", API_KEY)

        if apiurl is None:
            apiurl = os.environ.get("JBX_API_URL", API_URL)

        if accept_tac is None:
            if "JBX_ACCEPT_TAC" in os.environ:
                accept_tac = os.environ.get("JBX_ACCEPT_TAC") == "1"
            else:
                accept_tac = ACCEPT_TAC

        self.apikey = apikey
        self.apiurl = apiurl.rstrip("/")
        self.accept_tac = accept_tac
        self.timeout = timeout
        self.retries = retries

        if user_agent:
            user_agent += " (jbxapi.py {})".format(__version__)
        else:
            user_agent = "jbxapi.py {}".format(__version__)

        self.session = requests.Session()
        self.session.verify = verify_ssl
        self.session.proxies = proxies
        self.session.headers.update({"User-Agent": user_agent}) 
开发者ID:joesecurity,项目名称:jbxapi,代码行数:49,代码来源:jbxapi.py


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