From 2b8353d3b3e533945bb82d6510ed2dfb15663045 Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Sun, 8 Jun 2014 10:28:26 +0100 Subject: [PATCH] Avoid unnecessary encode/decode cycles. --- requests/auth.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requests/auth.py b/requests/auth.py index 84cd9c8..9b6426d 100644 --- a/requests/auth.py +++ b/requests/auth.py @@ -25,11 +25,11 @@ CONTENT_TYPE_MULTI_PART = 'multipart/form-data' def _basic_auth_str(username, password): """Returns a Basic Auth string.""" - authstr = 'Basic ' + b64encode( - ('%s:%s' % (username, password)).encode('latin1') - ).strip() + authstr = 'Basic ' + to_native_string( + b64encode(('%s:%s' % (username, password)).encode('latin1')).strip() + ) - return to_native_string(authstr, encoding='latin1') + return authstr class AuthBase(object): -- 2.34.1