Skip to content

Commit

Permalink
[py] Fix encoding of basic auth header when using Python 3
Browse files Browse the repository at this point in the history
Fixes #3622
  • Loading branch information
davehunt committed Mar 10, 2017
1 parent 36ba4cc commit 55ed929
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py/selenium/webdriver/remote/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ def _request(self, method, url, body=None):
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(),
Expand Down

0 comments on commit 55ed929

Please sign in to comment.