Skip to content

Instantly share code, notes, and snippets.

@mohangowda-dev
Created June 9, 2020 15:18
Show Gist options
  • Select an option

  • Save mohangowda-dev/04cccbb49b5f562110292297b509de15 to your computer and use it in GitHub Desktop.

Select an option

Save mohangowda-dev/04cccbb49b5f562110292297b509de15 to your computer and use it in GitHub Desktop.
# Before You run the code open your cmd and use pip to install a package called speedtest-cli
# run the code [" pip install speedtest-cli "] in cmd
# Python program to test
# internet speed
import speedtest
st = speedtest.Speedtest()
option = int(input('''What speed do you want to test:
1) Download Speed
2) Upload Speed
3) Ping
4) All the three
Your Choice: '''))
if option == 1:
d = st.download()
d = d/1000000
print("Download : ",d)
elif option == 2:
u = st.upload()
u = u/1000000
print("Upload : ",u)
elif option == 3:
servernames =[]
st.get_servers(servernames)
p = st.results.ping
print("Ping : ",p)
elif option == 4:
d = st.download()
d = d / 1000000
print("Download : ", d)
u = st.upload()
u = u/1000000
print("Upload : ",u)
servernames =[]
st.get_servers(servernames)
p = st.results.ping
print("Ping : ",p)
else:
print("Please enter the correct choice !")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment