[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.

Should be compatible with Python 2 & 3 (tested with 3)

You will need three Python libraries installed.
Simply use pip to install them

pip install six
pip install speedtest_cli==1.0.6
pip install twython==3.4.0

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 is [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 [922]

You can also set it to an empty list: []
If you set this, then the script will test the closest 5 servers to your ISP location.

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

You then set the TWEET_THRESHOLD. If your download or upload speed is less than this percent of the ISP's speeds then it will send the Tweet.

You can then set the tweet to send. The default is:
TWEET = ("Hey @myisp why is my internet speed {dl:0.0f}down\{ul:0.0f}up"
        " when I pay for {ISP_DL:0.0f}down\{ISP_UL:0.0f}up in Chch, NZ?"
          " #speedtest #matthuisman")

dl, ul, ISP_DL, ISP_UL will be replaced by the actual values.
0.0f is formatting the numbers to have 0 decimal places.
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 speedtester.py and watch it check your speeds and then tweet your ISP is out of line.

Next, set up a cron to run the script every X to keep your ISP inline.