Skip to content
Myr

improve `proxy_manager_for` re-usability by subclass

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Ben Bass · committed by Ben Bass · parent e3d0ac7 · Browse files · 1 file+10 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−5 removed

  • other:+10 added−5 removed

1 file+10 added−5 removed

modified:requests/adapters.py+10 added-5 removed
116 unmodified lines
117118 self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize,119 block=block)120121 def proxy_manager_for(self, proxy):122 """Return urllib3 ProxyManager for the given proxy. This method should123 not be called from user code, and is only exposed for use when124 subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.121 def proxy_manager_for(self, proxy, **proxy_kwargs):122 """Return urllib3 ProxyManager for the given proxy.123124 This method should not be called from user code, and is only125 exposed for use when subclassing the126 :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.127128 :param proxy: The proxy to return a urllib3 ProxyManager for.129 :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager.130 :returns: ProxyManager131 """132 if not proxy in self.proxy_manager:133 proxy_headers = self.proxy_headers(proxy)134 self.proxy_manager[proxy] = proxy_from_url(135 proxy,136 proxy_headers=proxy_headers,137 num_pools=self._pool_connections,138 maxsize=self._pool_maxsize,135 block=self._pool_block)139 block=self._pool_block,140 **proxy_kwargs)141142 return self.proxy_manager[proxy]143144 def cert_verify(self, conn, url, verify, cert):
258 unmodified lines