From 762021737c7b3cfc74481380f37cb69358c42fc2 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Thu, 12 Mar 2020 19:14:33 +0000 Subject: [PATCH] utf8 encode basic auth username/password --- src/treq/auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/treq/auth.py b/src/treq/auth.py index d693ff33..e253d39c 100644 --- a/src/treq/auth.py +++ b/src/treq/auth.py @@ -28,7 +28,7 @@ def request(self, method, uri, headers=None, bodyProducer=None): def add_basic_auth(agent, username, password): creds = base64.b64encode( - '{0}:{1}'.format(username, password).encode('ascii')) + u'{}:{}'.format(username, password).encode('utf8')) return _RequestHeaderSettingAgent( agent, Headers({b'Authorization': [b'Basic ' + creds]}))