diff --git a/requests/utils.py b/requests/utils.py index 528e7c90..7b7ff0a7 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -634,14 +634,11 @@ def except_on_missing_scheme(url): def get_auth_from_url(url): """Given a url with authentication components, extract them into a tuple of username,password.""" - if url: - parsed = urlparse(url) + parsed = urlparse(url) - try: - auth = (unquote(parsed.username), unquote(parsed.password)) - except (AttributeError, TypeError): - auth = ('', '') - else: + try: + auth = (unquote(parsed.username), unquote(parsed.password)) + except (AttributeError, TypeError): auth = ('', '') return auth