DEV Community

Cover image for YOU CAN TEST YOUR WI-FI SPEED USING PYTHON
Sameer Qaiser
Sameer Qaiser

Posted on

YOU CAN TEST YOUR WI-FI SPEED USING PYTHON

I was writing a tutorial on Python automation and realized I can test my internet speed without ever opening a browser.

If you have the speedtest-cli library installed, you can run this:

import speedtest

st = speedtest.Speedtest()
st.get_best_server()

print(f"Download: {st.download() / 1_000_000:.2f} Mbps")
print(f"Upload: {st.upload() / 1_000_000:.2f} Mbps")
Enter fullscreen mode Exit fullscreen mode

It runs in the background and gives you exact numbers. Super handy if you have a lot of smart home gadgets and want to check if your router is acting up.

What are some of your favorite small Python scripts for everyday tasks?

Top comments (0)