From 132540956051e9486ffb3adcee95b47a71a37c80 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 22 Mar 2013 00:12:58 -0400 Subject: [PATCH] simplify get_auth_from_url call --- requests/models.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/requests/models.py b/requests/models.py index d83562a2..dd17e823 100644 --- a/requests/models.py +++ b/requests/models.py @@ -222,11 +222,10 @@ class Request(RequestHooksMixin): p.prepare_body(self.data, self.files) # Note that prepare_auth must be last to enable authentication schemes # such as OAuth to work on a fully prepared request. - if self.auth is None: - auth = get_auth_from_url(self.url) - if auth[0] is not None and auth[1] is not None: - self.auth = auth - p.prepare_auth(self.auth) + + embedded_auth = get_auth_from_url(self.url) + p.prepare_auth(self.auth or embedded_auth) + # This MUST go after prepare_auth. Authenticators could add a hook p.prepare_hooks(self.hooks)