aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/test_framework/authproxy.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py
index 747bda309c..8b2f31624a 100644
--- a/test/functional/test_framework/authproxy.py
+++ b/test/functional/test_framework/authproxy.py
@@ -33,20 +33,14 @@ ServiceProxy class:
- uses standard Python json lib
"""
-try:
- import http.client as httplib
-except ImportError:
- import httplib
import base64
import decimal
+import http.client
import json
import logging
import socket
import time
-try:
- import urllib.parse as urlparse
-except ImportError:
- import urlparse
+import urllib.parse
USER_AGENT = "AuthServiceProxy/0.1"
@@ -60,7 +54,7 @@ class JSONRPCException(Exception):
errmsg = '%(message)s (%(code)i)' % rpc_error
except (KeyError, TypeError):
errmsg = ''
- Exception.__init__(self, errmsg)
+ super().__init__(errmsg)
self.error = rpc_error
@@ -77,7 +71,7 @@ class AuthServiceProxy(object):
self.__service_url = service_url
self._service_name = service_name
self.ensure_ascii = ensure_ascii # can be toggled on the fly by tests
- self.__url = urlparse.urlparse(service_url)
+ self.__url = urllib.parse.urlparse(service_url)
if self.__url.port is None:
port = 80
else:
@@ -98,10 +92,10 @@ class AuthServiceProxy(object):
# Callables re-use the connection of the original proxy
self.__conn = connection
elif self.__url.scheme == 'https':
- self.__conn = httplib.HTTPSConnection(self.__url.hostname, port,
+ self.__conn = http.client.HTTPSConnection(self.__url.hostname, port,
timeout=timeout)
else:
- self.__conn = httplib.HTTPConnection(self.__url.hostname, port,
+ self.__conn = http.client.HTTPConnection(self.__url.hostname, port,
timeout=timeout)
def __getattr__(self, name):
@@ -124,7 +118,7 @@ class AuthServiceProxy(object):
try:
self.__conn.request(method, path, postdata, headers)
return self._get_response()
- except httplib.BadStatusLine as e:
+ except http.client.BadStatusLine as e:
if e.line == "''": # if connection was closed, try again
self.__conn.close()
self.__conn.request(method, path, postdata, headers)