Test Internet Speed using Python

1

Python should be installed on the machine prior to the execution of the following codes. Download Python.

Python is a high-level, object-oriented programming language. Guido van Rossum was the creator of Python and he first released it in 1991. Python programming language is a good starter language for beginners to start with and can pursue their careers with Python in different sectors. Python has been a popular and go-to language all over the globe and it has started gaining some momentum in the context of Nepal as compared to other languages.

For the purpose of testing the speed of the internet, we will be using a Python module called speedtest-cli.

Installation

pip / easy_install

pip install speedtest-cli

or

easy_install speedtest-cli
Github
pip install git+https://github.com/sivel/speedtest-cli.git

or

git clone https://github.com/sivel/speedtest-cli.git
cd speedtest-cli
python setup.py install

once the installation is completed successfully, do ensure with the version check using the following command.

speedtest-cli --version

You should see something like this in your terminal.

speedtest-cli-version check

With the installation of the speedtest-cli module now we can simply test the speed of the internet by the following command.

speedtest-cli

You should see something like this in your terminal.

speedtest cli

As the above screenshot shows the test is done in MegaBit. We can easily test in bytes by using the following command.

speedtest-cli --bytes

We even can get a sharable link of the internet speed test using the following command.

speedtest-cli --share

We should now paste the URL to the browser and a screenshot of the result will arise like below.

speed test browser

We can even preview only the basic aspects of the test i.e. PING, DOWNLOAD, and UPLOAD using the following command.

speedtest-cli --simple

speed test simple

Besides all the test stuff, we can check all the available offerings from the command below.

speedtest-cli -h

speed test available offerings

In addition to that, we can look for help when need using the following command.

speedtest-cli --help

speed test help

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More