Twitter Bot in Python

This is going to be a short one. A quick update on something which I have already done.

I had prepared my bot in R using twitteR package and soon after it went live, I started facing issues like no function to follow the user, no function to mute them etc. I soon realized that I have to switch to Python for this. As I had started with R, I kept the first part as it is and started working for other parts in Python. The recent version was a hybrid one which was half in Python and half in R.

Search a tweet with #GoodMorning and replying it back was done in R and follow/ unfollowing people along with muting them was done in Python. I had started working on other additional features as well and that too in Python. I knew sooner or later I have to move the entire code in Python as this hybrid one would not last longer but I was just being too lazy or pretending to be busy to complete it.

Finally, one day I decided to do it. The coding part didn’t take much time but the scheduling one was a little different than the previous one and hence, it took some time to figure out.

Also, I have used both twython and tweepy package here. Functionality wise nothing has been changed, only change is in the code.

You can find the detailed code here on Github.

PS – at the time of writing this article I remember there is a new (or updated) package in R related to twitter which handles all this stuff. Not sure, though. I am python guy now. 😉

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s