Publish internet speeds on Twitter with speedtest-cli and speedtest.py

Originally published at: https://bayton.org/docs/linux/ubuntu/publish-internet-speeds-on-twitter-with-speedtest-cli-and-speedtest-py/

If you’re someone who struggles with poor internet speeds and finds the mind-numbing rigmarole of contacting your ISP to complain over and over again – with the same old scripted “are you using WiFi or ethernet? Have you turned your router off and on again? There aren’t any problems reported in your area” – unbearable, here’s another option: Tweet it. Not manually, of course, because that invokes the same issues as above; rather instead by creating a Twitter app, associating it with a new, dedicated account and making use of Twitter’s API via a couple of open-source scripts to publicly report your current internet speed on a regular basis. Will it encourage the ISP to resolve the issue? Possibly. It will however definitely highlight the problems you’re facing and act as a warning for others considering signing up for the same service, so that’s useful. 1. Prerequisites In order to set this up, you’ll need the following: An always-on device capable of running Python scripts. For this guide Ubuntu server in an LXD container will be used, however a RaspberryPi is another good choice given its minuscule power requirements and immensely small form factor. Speedtest-cli, a command-line alternative to the speedtest.net website Speedtest.py, an open-source Python script that combines Twitter’s API with speedtest-cli and tweets the result A Twitter account A Twitter app 2. Set up Ubuntu As always, before undertaking any of the following steps, ensure the server is up to date by running: sudo apt update && sudo…