RaspberryPi / Python Twitterbot
This is a very small python(2.7) project, that will let your pi tweet its 'system health' (aka free disk space, free memory, CPU load and temperature and finally uptime) to Twitter. Main goal for the project was me learning python and stuff, and also putting this on GitHub just for the fun of it. Because why not.
The script uses tweepy for the connection to twitter and psutil to gather all the health metrics. I suggest using a virtual environment here, so that only this script uses tweepy and psutil, because likely, you don't need them (at least tweepy though) as a standard python package for other projects. A great intro-guide for virtual env is this one here: https://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/
The first thing you need is to get Twitter app/developer key, tokens and secrets. There is a brillant guide on this on the official raspberrypi.org-site how to do this: '#2 Create a Twitter application' (https://www.raspberrypi.org/learning/getting-started-with-the-twitter-api/worksheet/). Follow this to get the tokens and stuff, and copy them into the script on the according places. The rest should be just letting the script run. Calculating uptime was a pain for me as a newbie, there's got to be a ton more of different and easier way of doing this.
If the string with the health data is longer than 140 characters, it'll be cut down to 140 and then tweeted.
I have this in a cron job (sudo apt-get install gnome-schedule) executed hourly. Do whatever you like here.
My Blogpost / HowTo to this: https://herrschroedinger.codes/i-built-a-raspberrypi-twitter-bot-because-why-not-thats-why/
tweetbotv2.py This time in python3, and it's able to read the tweets from a file, and also record what it tweeted into another 2nd file. Posted Tweets are removed from the 'pool file', because Twitter doesn't like repeats.
The Blogpost / HowTo to the v2 bot: https://herrschroedinger.codes/pythonraspberrypi-twitterbot-v2-reading-and-tweeting-from-a-file-with-prepared-tweets/