本文整理匯總了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.")
示例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