Thursday, December 04, 2008

A script for adding multiple twitter follows....

@magitam had an interesting problem and I had an itch to try out the python-twitter API.

follow.py is the result.

Usage: ./follow.py <twitter username> <twitter password> <filename.csv>")

Copy the code above and save it using notepad as follow.py

You will need a python interpreter and the python-twitter API to run it. Tested on Linux but should run anywhere.

The input file can be either:
friend1

friend2

friend3

or
friend1,friend2,friend3

or
friend1,friend2

friend3

Disclaimer: I will not take responsibility for loss of life, revenue, sex drive, property or any negative consequence suffered as a result of using the above code.

[gallery]

2 comments:

Farhan Rehman said...

Thanks @yusufk - I really appreciate it :)
Just to clarify - where do I need to have the python-twitter API? Does it have to be installed locally on my computer? I'm guessing it might be just a library or dependency, right?
Will try it out on Asus EEE PC later today, and tweet you if I come across any problems!
Thanks so much dude! Between you and @lord_matty I hope that I'll be able to get this challenge dealt with!

Joey said...

Yes it is a library and if you're running Ubuntu, its as easy as apt-get install python-twitter

There are instructions on the python-twitter site for installing it on other platforms.

Good luck!