Twitter bot
Mar. 2nd, 2011 10:25 amI decided to start learning Python by creating a Twitter bot. I have an online diary, that I have been keeping for over a decade now, and I decided that I would output lines from it as tweets, so that I could keep in touch with my younger self. If you want to see it in action: Echochild.
( Things I found odd to start with in Python )
There are quite a few Python to Twitter packages, but in the end, I decided upon Tweepy.( Installing Tweepy )
I formatted the diary entries, using Vi, so that there is just one sentence per line.
I got the appropriate authorisation tokens from Twitter: consumer token, consumer secret, etc.
Due to access restrictions, I am unable to run cron jobs or leave things running in the background, so concluded that being able to tweet just by going to a web page would do. Not quite automatic, but still, will do for now.
I then created a CGI script in the joshthecoder-tweepy-fcaff74 directory.( CGI script )
The next thing to do is make it actually reply to people!
( Things I found odd to start with in Python )
There are quite a few Python to Twitter packages, but in the end, I decided upon Tweepy.( Installing Tweepy )
I formatted the diary entries, using Vi, so that there is just one sentence per line.
I got the appropriate authorisation tokens from Twitter: consumer token, consumer secret, etc.
Due to access restrictions, I am unable to run cron jobs or leave things running in the background, so concluded that being able to tweet just by going to a web page would do. Not quite automatic, but still, will do for now.
I then created a CGI script in the joshthecoder-tweepy-fcaff74 directory.( CGI script )
The next thing to do is make it actually reply to people!