diff options
Diffstat (limited to 'requests/auth.py')
-rw-r--r-- | requests/auth.py | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/requests/auth.py b/requests/auth.py index 1a182dff..e3cbcffd 100644 --- a/requests/auth.py +++ b/requests/auth.py @@ -12,7 +12,6 @@ import re import time import hashlib import threading -import warnings from base64 import b64encode @@ -28,33 +27,13 @@ CONTENT_TYPE_MULTI_PART = 'multipart/form-data' def _basic_auth_str(username, password): """Returns a Basic Auth string.""" - # "I want us to put a big-ol' comment on top of it that - # says that this behaviour is dumb but we need to preserve - # it because people are relying on it." - # - Lukasa - # - # These are here solely to maintain backwards compatibility - # for things like ints. This will be removed in 3.0.0. if not isinstance(username, basestring): - warnings.warn( - "Non-string usernames will no longer be supported in Requests " - "3.0.0. Please convert the object you've passed in ({0!r}) to " - "a string or bytes object in the near future to avoid " - "problems.".format(username), - category=DeprecationWarning, - ) - username = str(username) + raise TypeError('username must be of type str or bytes, ' + 'instead it was %s' % type(username)) if not isinstance(password, basestring): - warnings.warn( - "Non-string passwords will no longer be supported in Requests " - "3.0.0. Please convert the object you've passed in ({0!r}) to " - "a string or bytes object in the near future to avoid " - "problems.".format(password), - category=DeprecationWarning, - ) - password = str(password) - # -- End Removal -- + raise TypeError('password must be of type str or bytes, ' + 'instead it was %s' % type(password)) if isinstance(username, str): username = username.encode('latin1') @@ -97,14 +76,6 @@ class HTTPBasicAuth(AuthBase): return r -class HTTPProxyAuth(HTTPBasicAuth): - """Attaches HTTP Proxy Authentication to a given Request object.""" - - def __call__(self, r): - r.headers['Proxy-Authorization'] = _basic_auth_str(self.username, self.password) - return r - - class HTTPDigestAuth(AuthBase): """Attaches HTTP Digest Authentication to the given Request object.""" |