From 76264fd19f594fd8665176633081a9081f1a0b56 Mon Sep 17 00:00:00 2001 From: galgolan Date: Mon, 5 Sep 2016 15:32:21 +0300 Subject: [PATCH] fixed gzip support --- speedtest_cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/speedtest_cli.py b/speedtest_cli.py index be7726b..f1c8ac8 100755 --- a/speedtest_cli.py +++ b/speedtest_cli.py @@ -383,7 +383,11 @@ def getConfig(): response = uh.open(request) - text = gzip.GzipFile(fileobj=StringIO.StringIO(response.read())).read() + if (response.headers['content-encoding'] == 'gzip'): + text = gzip.GzipFile(fileobj=StringIO.StringIO(response.read())).read() + else: + text = response.read() + configxml = [] configxml.append(text)