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


Python socks.SOCKSProxyManager方法代码示例

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


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

示例1: SOCKSProxyManager

# 需要导入模块: from pip._vendor.urllib3.contrib import socks [as 别名]
# 或者: from pip._vendor.urllib3.contrib.socks import SOCKSProxyManager [as 别名]
def SOCKSProxyManager(*args, **kwargs):
        raise InvalidSchema("Missing dependencies for SOCKS support.") 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:4,代码来源:adapters.py

示例2: proxy_manager_for

# 需要导入模块: from pip._vendor.urllib3.contrib import socks [as 别名]
# 或者: from pip._vendor.urllib3.contrib.socks import SOCKSProxyManager [as 别名]
def proxy_manager_for(self, proxy, **proxy_kwargs):
        """Return urllib3 ProxyManager for the given proxy.

        This method should not be called from user code, and is only
        exposed for use when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

        :param proxy: The proxy to return a urllib3 ProxyManager for.
        :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager.
        :returns: ProxyManager
        :rtype: urllib3.ProxyManager
        """
        if proxy in self.proxy_manager:
            manager = self.proxy_manager[proxy]
        elif proxy.lower().startswith('socks'):
            username, password = get_auth_from_url(proxy)
            manager = self.proxy_manager[proxy] = SOCKSProxyManager(
                proxy,
                username=username,
                password=password,
                num_pools=self._pool_connections,
                maxsize=self._pool_maxsize,
                block=self._pool_block,
                **proxy_kwargs
            )
        else:
            proxy_headers = self.proxy_headers(proxy)
            manager = self.proxy_manager[proxy] = proxy_from_url(
                proxy,
                proxy_headers=proxy_headers,
                num_pools=self._pool_connections,
                maxsize=self._pool_maxsize,
                block=self._pool_block,
                **proxy_kwargs)

        return manager 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:38,代码来源:adapters.py


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