Skip to content
Myr

urllib3 update

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

#1053

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 12d66cf · Browse files · 1 file+13 added−3 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+13 added−3 removed

  • other:+13 added−3 removed

1 file+13 added−3 removed

modified:requests/packages/urllib3/poolmanager.py+13 added-3 removed
145 unmodified lines
146147class ProxyManager(RequestMethods):148 """149 Given a ConnectionPool to a proxy, the ProxyManager's ``urlopen`` method150 will make requests to any url through the defined proxy.150 will make requests to any url through the defined proxy. The ProxyManager151 class will automatically set the 'Host' header if it is not provided.152 """153154 def __init__(self, proxy_pool):155 self.proxy_pool = proxy_pool156156 def _set_proxy_headers(self, headers=None):157 def _set_proxy_headers(self, url, headers=None):158 """159 Sets headers needed by proxies: specifically, the Accept and Host160 headers. Only sets headers not provided by the user.161 """162 headers_ = {'Accept': '*/*'}163164 host = parse_url(url).host165 if host:166 headers_['Host'] = host167168 if headers:169 headers_.update(headers)170171 return headers_172173 def urlopen(self, method, url, **kw):174 "Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute."175 kw['assert_same_host'] = False166 kw['headers'] = self._set_proxy_headers(kw.get('headers'))176 kw['headers'] = self._set_proxy_headers(url, headers=kw.get('headers'))177 return self.proxy_pool.urlopen(method, url, **kw)178179180def proxy_from_url(url, **pool_kw):
2 unmodified lines