Skip to content
Myr

Fixes #20.

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 · parent 1359094 · Browse files · 1 file+17 added−2 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+17 added−2 removed

  • other:+17 added−2 removed

1 file+17 added−2 removed

modified:requests/core.py+17 added-2 removed
284 unmodified lines
285 def add_auth(self, uri, auth):286 """Registers AuthObject to AuthManager."""287288 uri = self.reduce_uri(uri, False)289290 # try to make it an AuthObject291 if not isinstance(auth, AuthObject):292 try:293 auth = AuthObject(*auth)294 except TypeError:295 pass296297 self._auth[uri] = auth298299 def add_password(self, realm, uri, user, passwd):300 """Adds password to AuthManager."""
18 unmodified lines
319 return (None, None)320321322 def get_auth(self, uri):315 uri = self.reduce_uri(uri, False)316 return self._auth.get(uri, None)323 (in_domain, in_path) = self.reduce_uri(uri, False)324325 for domain, path, authority in (326 (i[0][0], i[0][1], i[1]) for i in self._auth.iteritems()327 ):328 if in_domain == domain:329 if path in in_path:330 return authority331332333 def reduce_uri(self, uri, default_port=True):334 """Accept authority or URI and extract only the authority and path."""335 # note HTTP URLs do not have a userinfo component336 parts = urllib2.urlparse.urlsplit(uri)
13 unmodified lines
350 "https": 443,351 }.get(scheme)352 if dport is not None:353 authority = "%s:%d" % (host, dport)354355 return authority, path356357358 def is_suburi(self, base, test):
178 unmodified lines