From: Ben Bass Date: Sun, 18 May 2014 19:10:35 +0000 (+0100) Subject: improve `proxy_manager_for` re-usability by subclass X-Git-Tag: v2.4.0~34^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=02618c8df5071d608a8c8341e4a44e26f58215d5;p=services%2Fpython-requests.git improve `proxy_manager_for` re-usability by subclass --- diff --git a/requests/adapters.py b/requests/adapters.py index 6b8f4d3..995d8f8 100644 --- a/requests/adapters.py +++ b/requests/adapters.py @@ -118,12 +118,16 @@ class HTTPAdapter(BaseAdapter): self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize, block=block) - def proxy_manager_for(self, proxy): - """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 `. + 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 `. :param proxy: The proxy to return a urllib3 ProxyManager for. + :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. + :returns: ProxyManager """ if not proxy in self.proxy_manager: proxy_headers = self.proxy_headers(proxy) @@ -132,7 +136,8 @@ class HTTPAdapter(BaseAdapter): proxy_headers=proxy_headers, num_pools=self._pool_connections, maxsize=self._pool_maxsize, - block=self._pool_block) + block=self._pool_block, + **proxy_kwargs) return self.proxy_manager[proxy]