diff options
author | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:41:34 -0700 |
---|---|---|
committer | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:41:34 -0700 |
commit | 2c79b40c98c83e352c5479223d581d69b0e7806c (patch) | |
tree | 81c85525061fbc4805ff2ec2280f560956c35d64 /requests/auth.py | |
parent | d075cc8a1294c77c994dc5fd220ecb163ed31b93 (diff) | |
download | python-requests-2c79b40c98c83e352c5479223d581d69b0e7806c.tar python-requests-2c79b40c98c83e352c5479223d581d69b0e7806c.tar.gz |
Imported Upstream version 2.4.3
Diffstat (limited to 'requests/auth.py')
-rw-r--r-- | requests/auth.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/requests/auth.py b/requests/auth.py index 9f831b7..9b6426d 100644 --- a/requests/auth.py +++ b/requests/auth.py @@ -16,7 +16,7 @@ from base64 import b64encode from .compat import urlparse, str from .cookies import extract_cookies_to_jar -from .utils import parse_dict_header +from .utils import parse_dict_header, to_native_string CONTENT_TYPE_FORM_URLENCODED = 'application/x-www-form-urlencoded' CONTENT_TYPE_MULTI_PART = 'multipart/form-data' @@ -25,7 +25,11 @@ CONTENT_TYPE_MULTI_PART = 'multipart/form-data' def _basic_auth_str(username, password): """Returns a Basic Auth string.""" - return 'Basic ' + b64encode(('%s:%s' % (username, password)).encode('latin1')).strip().decode('latin1') + authstr = 'Basic ' + to_native_string( + b64encode(('%s:%s' % (username, password)).encode('latin1')).strip() + ) + + return authstr class AuthBase(object): |