In this script we will create a program to check Internet Speed using Python.
Python can be used for many tasks such as web development, machine learning, Gui applications. It can also be used for testing Internet speed. Python provides various libraries for doing the same. One such library is speedtest-cli.
This library is a command-line interface for testing internet bandwidth using speedtest.net
pip install speedtest-cli{codeBox}
Check out below video tutorial with live demo.
Test Internet Speed using Python Code:
black, magenta, cyan = "\033[0;30m", "\033[0;35m", "\033[0;36m"
# Some colors to make output look a bit nicer
import speedtest
#pip install speedtest-clist = speedtest.Speedtest()print(magenta + "Please wait, calculating download speed....")print(cyan + "Your download speed is " + str(st.download()/10**6) + " Mbps\n")
print(magenta + "Please wait, calculating upload speed....")print(cyan + "Your upload speed is " + str(st.upload()/10**6) + " Mbps\n")print(cyan + "Your ping is " + str(st.results.ping) + " MS" + black){codeBox}
Using floor division with 10**6 to conver into Mbps.{alertInfo}
Subscribe our channel for more Python projects
0 Comments