diff --git a/speedtest_cli.py b/speedtest_cli.py index f4bf1f9..8382fff 100755 --- a/speedtest_cli.py +++ b/speedtest_cli.py @@ -294,11 +294,9 @@ class HTTPUploaderData(object): self.timeout = timeout chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - data = chars * (int(round(int(length) / 36.0))) - self.data = StringIO() - self.data.write('content1=%s' % data[0:int(length) - 9]) - del data - self.data.seek(0) + multiplier = int(round(int(length) / 36.0)) + self.data = StringIO('content1=%s' % + (chars * multiplier)[0:int(length) - 9]) self.total = [0] @@ -341,6 +339,8 @@ class HTTPUploader(threading.Thread): except: self.result = sum(self.data.total) + del self.data + class SpeedtestResults(object): """Class for holding the results of a speedtest, including: