This commit is contained in:
Gamerhythm 2017-04-29 05:33:18 +00:00 committed by GitHub
commit a936d8ea72
1 changed files with 15 additions and 0 deletions

View File

@ -71,6 +71,21 @@ 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")
You can use in terminal via the following:
::
$ speedtest-cli -h