From a92b7526eb8dbb3703a62d102c7f024de12c27ea Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Tue, 20 Nov 2018 22:21:26 +0300 Subject: [PATCH] some compatibility fix --- app/connections.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/connections.py b/app/connections.py index 53b57f2d..07180935 100644 --- a/app/connections.py +++ b/app/connections.py @@ -223,7 +223,7 @@ def http(user, password, url, callback): while True: url = yield with urlopen(url, timeout=5) as f: - msg = json.load(f).get("message", None) + msg = json.loads(f.read().decode("utf-8")).get("message", None) if msg: callback("HTTP: {}\n".format(msg)) @@ -270,10 +270,11 @@ def http_request(host, port, user, password): try: with urlopen(url, timeout=5) as f: - yield json.load(f) + yield json.loads(f.read().decode("utf-8")) except (URLError, HTTPError): yield None + # ***************** Connections testing *******************# @@ -293,7 +294,7 @@ def test_http(host, port, user, password, timeout=5): init_auth(user, password, url) with urlopen(url, timeout=5) as f: - return json.load(f).get("message", "") + return json.loads(f.read().decode("utf-8")).get("message", "") except (URLError, HTTPError) as e: raise TestException(e)