Skip to content

Commit

Permalink
[tests] authproxy.py: tidy up __init__()
Browse files Browse the repository at this point in the history
  • Loading branch information
John Newbery committed Oct 17, 2017
1 parent 323d8f6 commit 8f9e362
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions test/functional/test_framework/authproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,9 @@ def __init__(self, service_url, service_name=None, timeout=HTTP_TIMEOUT, connect
self._service_name = service_name
self.ensure_ascii = ensure_ascii # can be toggled on the fly by tests
self.__url = urllib.parse.urlparse(service_url)
if self.__url.port is None:
port = 80
else:
port = self.__url.port
(user, passwd) = (self.__url.username, self.__url.password)
try:
user = user.encode('utf8')
except AttributeError:
pass
try:
passwd = passwd.encode('utf8')
except AttributeError:
pass
port = 80 if self.__url.port is None else self.__url.port
user = None if self.__url.username is None else self.__url.username.encode('utf8')
passwd = None if self.__url.password is None else self.__url.password.encode('utf8')
authpair = user + b':' + passwd
self.__auth_header = b'Basic ' + base64.b64encode(authpair)

Expand Down

0 comments on commit 8f9e362

Please sign in to comment.