aboutsummaryrefslogtreecommitdiff
path: root/requests/auth.py
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:41:34 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:41:34 -0700
commit2c79b40c98c83e352c5479223d581d69b0e7806c (patch)
tree81c85525061fbc4805ff2ec2280f560956c35d64 /requests/auth.py
parentd075cc8a1294c77c994dc5fd220ecb163ed31b93 (diff)
downloadpython-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.py8
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):