Twitter Bot

Ok… So… Trump’s administration has made it known that they do not believe climate science. As a result, I have taken it upon myself to collect a MONSTER list of links to climate research to be used in a Twitter Bot.

Step 0: Create a .txt file that is nothing more than a list of links to climate change data!

Step 1: Set up one of my RaspberryPi’s to work headlessly.

Step 2: PYTHON!

Step 3: Setup Twitter Bot page.


Step 5: …hmmm… so I’ve got the code to work. But… it seems after about 4 posts(2 hrs), the bot stops working…. This is annoying. Scratch head and return.
…Best guess, the server is timing out. Worst guess… Twitter bots work on pizza and beer and mine has neither.

*Will return to make this into a tutorial.*


I just discovered how to fix the “timing out” problem. I had a “derp.” need to use:

crontab -e

It will let me run the code at set times. So if I rewrite the code to select a line at random… I should be in the clear. But it also means I need to figure out how to deal with the exceptions/errors it sends back when a tweet is repeated.


Bot appears to be working:


The Twitter Bot is most definitely working!

You can find the tutorial and examples that I am putting together here: (the tutorial has been moved to-


I should probably note, after tinkering with the bot to have it send tweets to @realDonaldTrump for/in solidarity with #MarchForScience, Twitter canned the account temporarily. As a result, I returned the bot to its original state… but quickly got bored with it, and took the Pi that was executing the code offline. I also closed the Github page and moved the tutorial to:

That said, I am now in the very slow and tedious process of rewriting the code. It is my intent to write it in such a way as to incorporate a machine learning algorithm to sift thru searches and find legitimate research on the subject of climate change and post that… in short, no more list!

I may also add a feature to have the bot respond to Tweets sent to it… But that will likely be a feature I add later. In the meantime, I’ll be… Coding, getting ready for the SIAM Conference in Pittsburgh (I will be giving a poster presentation -come visit!), and reading up on Genetics and O-Chem.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s