Last active
April 26, 2020 19:49
-
-
Save vwillcox/b0351a817e8562ed74f8425ae5b18be0 to your computer and use it in GitHub Desktop.
Quick Python3 wrapper around the official Ookla Speedtest CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import json | |
stdoutdata = subprocess.getoutput("speedtest -f json") | |
#print(stdoutdata.split()[0]) | |
results = json.loads(stdoutdata) | |
for key in results: | |
download = results["download"]["bandwidth"] | |
upload = results["upload"]["bandwidth"] | |
isp = results["isp"] | |
down = str(round(download / 125000, 2)) | |
up = str(round(upload / 125000, 2)) | |
print("Download: "+ down + "Mbps") | |
print("Upload: " + up + "Mbps") | |
print("Internet Provider: " + isp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment