Use encodebytes instead of encodestring (deprecated since Py 3.1)

This commit is contained in:
delirious-lettuce
2018-02-18 19:04:40 -07:00
committed by Marcin Kulik
parent f3fecec1b8
commit 52a33b764b

View File

@@ -67,7 +67,7 @@ class URLLibHttpAdapter:
if password: if password:
auth = "%s:%s" % (username, password) auth = "%s:%s" % (username, password)
encoded_auth = base64.encodestring(auth.encode('utf-8'))[:-1] encoded_auth = base64.encodebytes(auth.encode('utf-8'))[:-1]
headers["Authorization"] = b"Basic " + encoded_auth headers["Authorization"] = b"Basic " + encoded_auth
request = Request(url, data=body, headers=headers, method="POST") request = Request(url, data=body, headers=headers, method="POST")