views:

181

answers:

6

It seems there are at least five Python libraries for the Twitter API. Can those who have used them comment on your experiences?

+1  A: 

I just use urllib2 with simplejson. For something like a REST call, a library will usually just get in your way.

Paul Tarjan
Is the main advantage to this the simplicity?
Dan
simplicity and the ability to handle errors your own way. you don't have to go learn a library, you can just do web calls like you normally do.
Paul Tarjan
isn't the API supposed to support things like the limit and be able to scale back? how about streaming it seems your use of twitter via API is very limited.
Jorge Vargas
A: 

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.

fengb
+2  A: 

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.

Nosredna
A: 

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.

mwalling
A: 

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

inspectorG4dget
+1  A: 

Since I'm looking at this myself I think that things stand this way.

  1. 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
  2. no comments on twyt yet, other than bzr bleh!
  3. 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
  4. 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.
  5. and twisted is twisted :)
  6. 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.

Jorge Vargas
This is old, yeah, but I hope you don't mind if I comment for my own sake, in the eyes of Google. ;)That string in Twython's original docs about my "just learning" has hilariously stuck around for some time now, but that's a year or so old now. Twython is up to date, supports OAuth, and ships with an example Django application to get people started.
Ryan McGrath