🐍 How to run a Speedtest with Python
This tutorial describes how to run a speedtest on speedtest.net with Python.
Install the Python speedtest-cli module
Run the following command to install speedtest-cli the Python module.
python -m pip install speedtest-cli
Make an internet speed test using Python
Run the Python code either as a script or in the python
shell make a speed
test.
import speedtest
s = speedtest.Speedtest()
# servers returns the speedtest.net servers that are available to use
servers = s.get_servers()
# download returns the download speed
s.download()
# upload returns the upload speed
s.upload()
# return dictionary with all results (using the `json` you could convert that now)
s.results.dict()