Created
May 24, 2022 04:21
-
-
Save ChandanShakya/d3f65358a1469fc7eef2f83d1ca8ced6 to your computer and use it in GitHub Desktop.
Python script to do speedtest using speedtest-cli
This file contains hidden or 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
from speedtest import Speedtest | |
st = Speedtest() | |
# Download speed in Mbps | |
download = round(st.download() / 10**6, 2) | |
# Upload speed in Mbps | |
upload = round(st.upload() / 10**6, 2) | |
# Ping in ms | |
ping = round(st.results.ping, 2) | |
# Server name | |
server = st.results.server['name'] | |
# Server Location | |
location = st.results.server['country'] | |
print("Download:", download, "Mbps") | |
print("Upload:", upload, "Mbps") | |
print("Ping:", ping, "ms") | |
print("Server:", server) | |
print("Location:", location) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment