Skip to content
Myr

actually cleanup url authentication

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 52d328e · Browse files · 1 file+8 added−4 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+8 added−4 removed

  • other:+8 added−4 removed

1 file+8 added−4 removed

modified:requests/models.py+8 added-4 removed
218 unmodified lines
219 p.prepare_url(self.url, self.params)220 p.prepare_headers(self.headers)221 p.prepare_cookies(self.cookies)222 p.prepare_body(self.data, self.files)223 p.prepare_auth(self.auth, self.url)224 # Note that prepare_auth must be last to enable authentication schemes225 # such as OAuth to work on a fully prepared request.226226 embedded_auth = get_auth_from_url(self.url)227 p.prepare_auth(self.auth or embedded_auth)228227 # This MUST go after prepare_auth. Authenticators could add a hook228 p.prepare_hooks(self.hooks)229230 return p
164 unmodified lines
395 self.headers['Content-Length'] = str(len(body))396 elif self.method not in ('GET', 'HEAD'):397 self.headers['Content-Length'] = '0'398401 def prepare_auth(self, auth):399 def prepare_auth(self, auth, url=''):400 """Prepares the given HTTP auth data."""401402 # If no Auth is explicitly provided, extract it from the URL.403 if auth is None:404 url_auth = get_auth_from_url(self.url)405 auth = url_auth if any(url_auth) else None406407 if auth:408 if isinstance(auth, tuple) and len(auth) == 2:409 # special-case basic HTTP auth410 auth = HTTPBasicAuth(*auth)
260 unmodified lines