[Release] Python ISP Speed Twitter Bot Script

A simple Python script to tweet @ your ISP when your internet speed is less than what you are paying for.

I have tested this working with Python 3.5.
Should also work with Python 2.7.

You will need a two Python libraries installed.

Simply use pip to install them

pip install speedtest_cli
pip install twython

Once they are installed, download my script HERE.

Open the file in your favorite text editor or IDE.


The first thing you can set is SERVERS which is a list of speedtest.net server ID's to test against.
To find the server ID's, visit http://www.speedtest.net/speedtest-servers.php


The defaults ids are SERVERS = [922,4934] which are 2degrees & Vodafone Christchurch NZ servers.
If you have a list, it will test each and then calculate the average download and upload speed.
You can just have 1x server in the list if you just want to use a single server. eg SERVERS = [922]

You can also set SERVERS = []
If you set this, then the script will use the closest server (this is not always the best server).

Next you can put in your ISP's download and upload speeds that you are paying for.
These are in megabits per second which is the most common way they are advertised.

You then set the percentage threshold. If your download or upload speed is less than X percent of the ISP's speeds then it will send the Tweet.
Default is TWEET_THRESHHOLD = 70 (any speed less than 70 percent will send a tweet)

You then have DELAY. The script has been setup to run once and keep running every X seconds.
Default is DELAY = 60*60*24 (= 24 hours)

You can then set the tweet to send. Make sure you have 4 lots of the placeholders %0.0f or it will cause an error when it replaces those with your actual speeds.
The default is
TWEET = "Hey @bigisp why is my internet speed %0.0fdown\%0.0fup when I pay for %0.0fdown\%0.0fup in Chch, NZ? #bigisp #speedtest"


Remember to make sure it's under 140 characters.

The script is set to upload an image of the speed test results along with your tweet.
If you don't want the image, set POST_IMAGE = False.

Finally you have the 4x twitter variables that you need to set.

First, login to your twitter.
Now go to http://apps.twitter.com/ and create a new app



Now fill in the required fields.


(If you get an error about phone number, you need to go to your twitter settings and register your phone)

Once the app is created, go to the "Keys and Access Tokens" tab and click "Create my access token"


 Now copy the four fields into the script/


Save the script and it's now ready to go!

Simply run the script using python speedtest.py and watch it check your speeds and then tweet your ISP is out of line.

Note: This was just a quick script I wrote to test it out - there is little error checking etc.

Enjoy!