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")
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)