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


Python requests.__version__方法代码示例

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


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

示例1: sanity_check_dependencies

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def sanity_check_dependencies():
    import numpy
    import requests
    import six

    if distutils.version.LooseVersion(numpy.__version__) < distutils.version.LooseVersion('1.10.4'):
        logger.warn("You have 'numpy' version %s installed, but 'gym' requires at least 1.10.4. HINT: upgrade via 'pip install -U numpy'.", numpy.__version__)

    if distutils.version.LooseVersion(requests.__version__) < distutils.version.LooseVersion('2.0'):
        logger.warn("You have 'requests' version %s installed, but 'gym' requires at least 2.0. HINT: upgrade via 'pip install -U requests'.", requests.__version__)

# We automatically configure a logger with a simple stderr handler. If
# you'd rather customize logging yourself, run undo_logger_setup.
#
# (Note: this needs to happen before importing the rest of gym, since
# we may print a warning at load time.) 
开发者ID:ppaquette,项目名称:gym-pull,代码行数:18,代码来源:__init__.py

示例2: __init__

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def __init__(self,
                 timeout=None,
                 verify_cert=True):
        self.timeout = timeout
        self.verify_cert = verify_cert

        if self.timeout is not None:
            try:
                self.timeout = float(self.timeout)
                if not self.timeout >= 0:
                    raise ValueError
            except ValueError:
                raise PanHttpError('Invalid timeout: %s' % self.timeout)

        self.using_requests = _using_requests

        if self.using_requests:
            self._http_request = self._http_request_requests
            if not self.verify_cert:
                requests.packages.urllib3.disable_warnings()
            self.requests_version = requests.__version__
        else:
            self._http_request = self._http_request_urllib 
开发者ID:PaloAltoNetworks,项目名称:terraform-templates,代码行数:25,代码来源:http.py

示例3: test_requests_version

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def test_requests_version(self):
        client_args_timeout = {
            "key": "AIzaasdf",
            "client_id": "foo",
            "client_secret": "a2V5",
            "channel": "MyChannel_1",
            "connect_timeout": 5,
            "read_timeout": 5,
        }
        client_args = client_args_timeout.copy()
        del client_args["connect_timeout"]
        del client_args["read_timeout"]

        requests.__version__ = "2.3.0"
        with self.assertRaises(NotImplementedError):
            googlemaps.Client(**client_args_timeout)
        googlemaps.Client(**client_args)

        requests.__version__ = "2.4.0"
        googlemaps.Client(**client_args_timeout)
        googlemaps.Client(**client_args) 
开发者ID:googlemaps,项目名称:google-maps-services-python,代码行数:23,代码来源:test_client.py

示例4: log_current_versions

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def log_current_versions():
    """Show current installed versions"""
    if logger.root.isEnabledFor(logging.DEBUG):
        # MAC OS X
        if sys.platform == "darwin":
            os_version = "macOS {0}".format(platform.mac_ver()[0])
        # Windows
        elif sys.platform.startswith("win"):
            os_version = "{0} {1}".format(platform.system(), platform.release())
        # linux / other
        else:
            os_version = platform.platform()

        log.debug("OS:         {0}".format(os_version))
        log.debug("Python:     {0}".format(platform.python_version()))
        log.debug("Streamlink: {0}".format(streamlink_version))
        log.debug("Requests({0}), Socks({1}), Websocket({2})".format(
            requests.__version__, socks_version, websocket_version)) 
开发者ID:streamlink,项目名称:streamlink,代码行数:20,代码来源:main.py

示例5: log_current_versions

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def log_current_versions():
    '''Show current installed versions'''

    # MAC OS X
    if sys.platform == 'darwin':
        os_version = 'macOS {0}'.format(platform.mac_ver()[0])
    # Windows
    elif sys.platform.startswith('win'):
        os_version = '{0} {1}'.format(platform.system(), platform.release())
    # linux / other
    else:
        os_version = platform.platform()

    log.info('For LiveProxy support visit https://github.com/back-to/liveproxy')
    log.debug('OS:         {0}'.format(os_version))
    log.debug('Python:     {0}'.format(platform.python_version()))
    log.debug('LiveProxy:  {0}'.format(liveproxy_version))
    log.debug('Streamlink: {0}'.format(streamlink_version))
    log.debug('Requests:   {0}'.format(requests_version)) 
开发者ID:back-to,项目名称:liveproxy,代码行数:21,代码来源:main.py

示例6: systemInfo

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

示例7: __init__

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def __init__(self, creator, email, polygon=None):
        """class to setup a JSON doc with the query and POST a request

        All predicates (default key-value or iterative based on a list of
        values) are combined with an AND statement. Iterative predicates are
        creating a subset equal statements combined with OR

        :param creator: User name.
        :param email: user email
        :param polygon: Polygon of points to extract data from
        """
        self.predicates = []
        self._main_pred_type = "and"

        self.url = "http://api.gbif.org/v1/occurrence/download/request"
        self.header = {
            "accept": "application/json",
            "content-type": "application/json",
            "user-agent": "".join(
                [
                    "python-requests/",
                    requests.__version__,
                    ",pygbif/",
                    package_metadata.__version__,
                ]
            ),
        }

        self.payload = {
            "creator": creator,
            "notification_address": [email],
            "send_notification": "true",
            "created": datetime.date.today().year,
            "predicate": {"type": self._main_pred_type, "predicates": self.predicates},
        }
        self.request_id = None

        # prepare the geometry polygon constructions
        if polygon:
            self.add_geometry(polygon) 
开发者ID:sckott,项目名称:pygbif,代码行数:42,代码来源:download.py

示例8: make_ua

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def make_ua():
    return {
        "user-agent": "python-requests/"
        + requests.__version__
        + ",pygbif/"
        + pygbif.__version__
    } 
开发者ID:sckott,项目名称:pygbif,代码行数:9,代码来源:gbifutils.py

示例9: init_poolmanager

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def init_poolmanager(self, *args, **kwargs):
        if requests.__version__ >= '2.4.1':
            kwargs.setdefault('socket_options', [
                (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),
                (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
            ])
        super(TCPKeepAliveAdapter, self).init_poolmanager(*args, **kwargs) 
开发者ID:nttcom,项目名称:eclcli,代码行数:9,代码来源:client.py

示例10: _check_version

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def _check_version():
    if gaecontrib is None:
        raise exc.VersionMismatchError(
            "The toolbelt requires at least Requests 2.10.0 to be "
            "installed. Version {0} was found instead.".format(
                requests.__version__
            )
        ) 
开发者ID:alfa-addon,项目名称:addon,代码行数:10,代码来源:appengine.py

示例11: _check_version

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def _check_version(self):
        if PyOpenSSLContext is None:
            raise exc.VersionMismatchError(
                "The X509Adapter requires at least Requests 2.12.0 to be "
                "installed. Version {0} was found instead.".format(
                    requests.__version__
                )
            ) 
开发者ID:alfa-addon,项目名称:addon,代码行数:10,代码来源:x509.py

示例12: version

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def version() -> str:
    version_py = os.path.join(os.path.dirname(__file__), "zulip", "__init__.py")
    with open(version_py) as in_handle:
        version_line = next(itertools.dropwhile(lambda x: not x.startswith("__version__"),
                                                in_handle))
    version = version_line.split('=')[-1].strip().replace('"', '')
    return version 
开发者ID:zulip,项目名称:python-zulip-api,代码行数:9,代码来源:setup.py

示例13: cli

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def cli(ctx, obj):
    """Show Alerta server and client versions."""
    client = obj['client']
    click.echo('alerta {}'.format(client.mgmt_status()['version']))
    click.echo('alerta client {}'.format(client_version))
    click.echo('requests {}'.format(requests_version))
    click.echo('click {}'.format(click.__version__))
    ctx.exit() 
开发者ID:alerta,项目名称:python-alerta-client,代码行数:10,代码来源:cmd_version.py

示例14: make_ua

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def make_ua(mailto=None, ua_string=None):
    requa = "python-requests/" + requests.__version__
    habua = "habanero/%s" % __version__
    ua = requa + " " + habua
    if mailto is not None:
        ua = ua + " (mailto:%s)" % mailto
    if ua_string is not None:
        if not isinstance(ua_string, str):
            raise TypeError("ua_string must be a str")
        ua = ua + " " + ua_string
    strg = {"User-Agent": ua, "X-USER-AGENT": ua}
    return strg 
开发者ID:sckott,项目名称:habanero,代码行数:14,代码来源:habanero_utils.py

示例15: _check_package_version

# 需要导入模块: import requests [as 别名]
# 或者: from requests import __version__ [as 别名]
def _check_package_version(package_name, min_version):
    try:
        installed_version = None
        if package_name == 'frida':
            import frida
            installed_version = frida.__version__
        elif package_name == 'capstone':
            import capstone
            installed_version = capstone.__version__
        elif package_name == 'requests':
            import requests
            installed_version = requests.__version__
        elif package_name == 'pyqt5':
            from PyQt5 import QtCore
            installed_version = QtCore.PYQT_VERSION_STR
        elif package_name == 'pyperclip':
            import pyperclip
            installed_version = pyperclip.__version__
        if installed_version is not None:
            installed_version = installed_version.split('.')
            _min_version = min_version.split('.')
            needs_update = False
            if int(installed_version[0]) < int(_min_version[0]):
                needs_update = True
            elif (int(installed_version[0]) <= int(_min_version[0])) and (
                    int(installed_version[1]) < int(_min_version[1])):
                needs_update = True
            elif (int(installed_version[1]) <= int(_min_version[1])) and (
                    int(installed_version[2]) < int(_min_version[2])):
                needs_update = True

            if needs_update:
                print('updating ' + package_name + '... to ' + min_version)
                if pip_install_package(package_name + '>=' + min_version):
                    print('*** success ***')
    except Exception:  # pylint: disable=broad-except
        print('installing ' + package_name + '...')
        if pip_install_package(package_name + '>=' + min_version):
            print('*** success ***') 
开发者ID:iGio90,项目名称:Dwarf,代码行数:41,代码来源:dwarf.py


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