From 1f8583c4265fa3cceca09ce52b08cf8862404c7f Mon Sep 17 00:00:00 2001 From: Gamerhythm Date: Sat, 25 Feb 2017 17:57:06 +0000 Subject: [PATCH 1/3] Update README.rst --- README.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.rst b/README.rst index 1cb1865..28b8d72 100644 --- a/README.rst +++ b/README.rst @@ -71,6 +71,18 @@ or Usage ----- +You can use in another script via the following: + +:: + DownloadParsed = re.compile(r"Download: ([\d.]+) .bit") + UploadParsed = re.compile(r"Upload: ([\d.]+) .bit") + PingParsed = re.compile(r"([\d.]+) ms") + speedtest_result = str(subprocess.check_output(['speedtest-cli'], stderr=subprocess.STDOUT)) + download = DownloadParsed.search(speedtest_result).group(1) + upload = UploadParsed.search(speedtest_result).group(1) + ping = PingParsed.search(speedtest_result).group(1) + print("Download Speed: " + download + " mbps\n" + "Upload Speed: " + upload + " mbps\n" + "Ping: " + ping + " ms") + :: $ speedtest-cli -h From e0f27e0ced967cc24d5ab9d5cf17f138de5ac6e7 Mon Sep 17 00:00:00 2001 From: Gamerhythm Date: Sat, 25 Feb 2017 17:58:09 +0000 Subject: [PATCH 2/3] Update README.rst --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 28b8d72..fda953e 100644 --- a/README.rst +++ b/README.rst @@ -74,6 +74,7 @@ Usage You can use in another script via the following: :: + DownloadParsed = re.compile(r"Download: ([\d.]+) .bit") UploadParsed = re.compile(r"Upload: ([\d.]+) .bit") PingParsed = re.compile(r"([\d.]+) ms") From e6ae58464e679eb27f0a9b55b3fb23bc2240a027 Mon Sep 17 00:00:00 2001 From: Gamerhythm Date: Sat, 25 Feb 2017 18:00:56 +0000 Subject: [PATCH 3/3] Updated readme to how to use in other *.py scripts --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index fda953e..2275c3d 100644 --- a/README.rst +++ b/README.rst @@ -83,6 +83,8 @@ You can use in another script via the following: upload = UploadParsed.search(speedtest_result).group(1) ping = PingParsed.search(speedtest_result).group(1) print("Download Speed: " + download + " mbps\n" + "Upload Speed: " + upload + " mbps\n" + "Ping: " + ping + " ms") + +You can use in terminal via the following: ::