當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。