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


Python request.getproxies_environment方法代码示例

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


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

示例1: __init__

# 需要导入模块: from urllib import request [as 别名]
# 或者: from urllib.request import getproxies_environment [as 别名]
def __init__(self, service, operation, region_name, endpoint_url=None, session=None,
                 connect_timeout=None, request_timeout=None):
        # set credentials manually
        session = session or botocore.session.get_session()
        # get_session accepts access_key, secret_key
        self.client = session.create_client(
            service,
            region_name=region_name,
            endpoint_url=endpoint_url
        )
        try:
            self.endpoint = self.client.endpoint
        except AttributeError:
            self.endpoint = self.client._endpoint

        self.operation = operation
        self.http_client = AsyncHTTPClient()

        self.proxy_host = None
        self.proxy_port = None
        https_proxy = getproxies_environment().get('https')
        if https_proxy:
            self._enable_curl_httpclient()

            proxy_parts = https_proxy.split(':')
            if len(proxy_parts) == 2 and proxy_parts[-1].isdigit():
                self.proxy_host, self.proxy_port = proxy_parts
                self.proxy_port = int(self.proxy_port)
            else:
                proxy = urlparse(https_proxy)
                self.proxy_host = proxy.hostname
                self.proxy_port = proxy.port

        self.request_timeout = request_timeout
        self.connect_timeout = connect_timeout 
开发者ID:nanvel,项目名称:tornado-botocore,代码行数:37,代码来源:base.py

示例2: proxied

# 需要导入模块: from urllib import request [as 别名]
# 或者: from urllib.request import getproxies_environment [as 别名]
def proxied(value):
    netloc = urlparse(value).netloc
    proxied = bool(getproxies_environment()) and not proxy_bypass(netloc)
    return(proxied) 
开发者ID:oVirt,项目名称:ovirt-ansible-hosted-engine-setup,代码行数:6,代码来源:ovirt_proxied_check.py


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