Skip to main content

Posts

Showing posts with the label Download speed

Creating your own Speedtest utility in Python

It is easy to create your own speedtest utility in Python. You will require Speedtest-CLI module to build your utility. To install Speedtest-cli, run “ pip install speedtest-cli ” command Once speedtest-cli is installed, import it into your Python file. import speedtest result = speedtest . Speedtest ()   Following code will help you to find the best Speedtest server depending on your location best_server = result . get_best_server () print ( f "Checking speedtest using server located in { best_server [ 'country' ] } " )   Now, run the speed test for Download, Upload and ping result. # Running the download speed print ( "Running download speedtest..." ) dw_result = result . download () # Running the upload spped print ( "Running upload speedtest..." ) up_result = result . upload () # Running a ping test ping_result = result . results . ping   Using below code, you can covert the result in to Mbps and truncate the value to 2 decima