It seems there are at least five Python libraries for the Twitter API. Can those who have used them comment on your experiences?
I just use urllib2
with simplejson
. For something like a REST call, a library will usually just get in your way.
I personally use http://mike.verdone.ca/twitter/. I took a look at some other libraries but they seemed to be much bigger than what I needed but YMMV.
My experience with the Twitter REST APIs is that it's critical to handle errors well with retries. If you write everything as if all your results will be successful, you'll end up doing a lot of extra work going back to each REST call and dealing with errors.
I haven't used any of these libraries, but automatic handling of retries and a sensible way to dealing with Twitter's outages would be what I'd look for in a library, as the REST calls themselves are trivial.
Also, you only get 150 hits on the API per hour (unless you request IPs to be whitelisted). Retries will count against that (sometimes, maybe). Don't forget to check whether or not you have remaining hits (the call to check is free). Once I accidentally hit the API in a tight loop. Be careful--you can get blacklisted.
I used python-twitter for my Twittering Dehumidifer with no complaints, although my use case was very small and could probably have been handled as Paul described.
I'm using Yedda.Twitter.dll to work with IronPython. So far it has worked well and I am able to use it to post tweets. I have decompiled it and read it a bit and it seems to support most other functions. Although, I am not certain that it supports retweet just yet. As its dev page suggests, it is "more of a wrapper". But it has worked well for me thus far
Since I'm looking at this myself I think that things stand this way.
- python-twitter is the defacto old API stuff, it works very well unless you need new stuff (ie: streaming) They are several "third party" packages that provide some new functionality like http://code.google.com/p/oauth-python-twitter
- no comments on twyt yet, other than bzr bleh!
- tweepy seems to be the most actively develop right now and the guy behind it knows what he is doing. There is also some traction at http://groups.google.com/group/tweepy
- twython seems more like a toy, the author himself says he is learning, also http://groups.google.com/group/twython-talk is pretty much death.
- and twisted is twisted :)
- There is one not listed there which I have had very good results out of. It's streaming only but that is what I currently need. http://github.com/atl/twitstream Although I have to say my code is currently not in production.
Therefore I think tweepy is the winner if you need full features otherwise python-twitter with the extension projects/twitstream should be enough.