Skip to content
Myr

Merge branch 'proxy_auth' of https://github.com/chrisguitarguy/requests into develop

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

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 8f58c09, 4e2ecd6 · Browse files · 2 files+15 added−1 removed
This commit

State

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

Diff stats

2 files+15 added−1 removed

  • other:+15 added−1 removed

2 files+15 added−1 removed

modified:requests/auth.py+8 added
33 unmodified lines
34 r.headers['Authorization'] = ('Basic %s' % auth_s)35 return r363738class HTTPProxyAuth(HTTPBasicAuth):39 """Attaches HTTP Proxy Authenetication to a given Request object."""40 def __call__(self, r):41 auth_s = b64encode('%s:%s' % (self.username, self.password))42 r.headers['Proxy-Authorization'] = ('Basic %s' % auth_s)43 return r444546class HTTPDigestAuth(AuthBase):47 """Attaches HTTP Digest Authentication to the given Request object."""48 def __init__(self, username, password):49 self.username = username
83 unmodified lines
modified:requests/models.py+7 added-1 removed
15 unmodified lines
16from .hooks import dispatch_hook17from .structures import CaseInsensitiveDict18from .status_codes import codes19from .packages import oreos20from .auth import HTTPBasicAuth20from .auth import HTTPBasicAuth, HTTPProxyAuth21from .packages.urllib3.exceptions import MaxRetryError22from .packages.urllib3.exceptions import SSLError as _SSLError23from .packages.urllib3.exceptions import HTTPError as _HTTPError24from .packages.urllib3 import connectionpool, poolmanager
381 unmodified lines
406 proxy = self.proxies.get(_p.scheme)407408 if proxy:409 conn = poolmanager.proxy_from_url(proxy)410 _proxy = urlparse(proxy)411 if '@' in _proxy.netloc:412 auth, url = _proxy.netloc.split('@', 1)413 self.proxy_auth = HTTPProxyAuth(*auth.split(':', 1))414 r = self.proxy_auth(self)415 self.__dict__.update(r.__dict__)416 else:417 # Check to see if keep_alive is allowed.418 if self.config.get('keep_alive'):419 conn = self._poolmanager.connection_from_url(url)
270 unmodified lines