Skip to content

Commit dc5a865

Browse files
llaskinAutomatedTester
authored andcommitted
fix python HTTPS encoding for python driver (#3379)
* fix python HTTPS encoding for python driver * adding an if statement here to only do this if there is a username and password passed * fixing if statement * missed a colon
1 parent b1c2cf6 commit dc5a865

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/selenium/webdriver/remote/remote_connection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,10 @@ def _request(self, method, url, body=None):
471471
request.add_header('Accept', 'application/json')
472472
request.add_header('Content-Type', 'application/json;charset=UTF-8')
473473

474+
if parsed_url.username:
475+
base64string = base64.b64encode('%s:%s' % (parsed_url.username, parsed_url.password))
476+
request.add_header("Authorization", "Basic %s" % base64string)
477+
474478
if password_manager:
475479
opener = url_request.build_opener(url_request.HTTPRedirectHandler(),
476480
HttpErrorHandler(),

0 commit comments

Comments
 (0)