[py] Fix encoding of basic auth header when using Python 3
Fixes
@@ -476,8 +476,8 @@ class RemoteConnection(object):
request.add_header('Content-Type', 'application/json;charset=UTF-8')
if parsed_url.username:
- base64string = base64.b64encode('%s:%s' % (parsed_url.username, parsed_url.password))
- request.add_header("Authorization", "Basic %s" % base64string)
+ base64string = base64.b64encode('{0.username}:{0.password}'.format(parsed_url).encode())
+ request.add_header('Authorization', 'Basic {}'.format(base64string).decode())
if password_manager:
opener = url_request.build_opener(url_request.HTTPRedirectHandler(),
