Mike Verdon’s Python Twitter Tools is an awesome twitter library. It is less than 100 lines of code, and is very well commented. It uses the dynamic language features and creates the methods on the fly and returns the python dictionary.
The best part: It is dynamic and creates methods on the fly. So there is no need for any documentation beyond the standard twitter API documentation pbwiki. Use the url patterns after `/` as the object parameters by separating them by a `.`.
There is a global constants file that has a list of all methods that must be a POST and it makes post requests for those and get requests for the rest. Infact the author has even written a documentation scrapper that parses the twitter documentation to find out which methods are POST.*
Using it is very simple and pretty straightforward.
#Instantiation: from twitter import Twitter
t = Twitter()
Jerod Santo showed how using a ruby twitter gem library, he was able to find the people not following you back in twitter in less than 15 lines of code. A perl guy demonstrated to do the same in the Zen Perl library.
So how many lines of code would it take using the library that I think is the best across all languages. Lets try out.
Finding Friends ids? From the twitter API wiki:
URL = http://twitter.com/friends/ids.format
Thus, our method for finding the friends of a given user will be
and thus the entire code to print all those the user follows but who is inturn not followed back is as follows:
*However this auto updating of POST functions is yet to be updated as the documentation format got changed, recently after @dougw joined.