What is the best Python-Wrapper for the Twitter API 1.1? [closed]
Asked Answered
M

1

7

I've recently read the book "21 Recipes for Mining Twitter", and there they use the python-twitter - Wrapper by sixohsix.

It seems to me that this library is a bit outdated, since it still has a distinction between the Search API and the REST API. It seems to be made for the API Version 1, but Version 1.1 requires authentication for searching Twitter.

In sixohsix's approach, you establish a Twitter search in the following way:

twitter_search = twitter.Twitter(domain="search.twitter.com")
...
twitter_search.search(q="myquery")

At the same time, a connection to the "regular" REST API needs something like this:

twitter.Twitter(domain='search.twitter.com', api_version='1.1',\
                     auth=twitter.oauth.OAuth(access_token, access_token_secret,\
                    consumer_key, consumer_secret))

But I thought in 1.1, search also needs OAuth! Either the Twitter documentation is quite confusing or sixohsix's library is really kinda outdated.

Final question: What Python library should I use to easily and, most important: consistently establish searches and other REST calls to the API 1.1? I saw bear's library, which seems to be more constistent.

But maybe I am totally on the wrong path.. I would like to hear advice from some experienced Python people who interact a lot with Twitter's 1.1 API. Thanks.

EDIT See #issue 109 on sixohsix's Github - the issue has been fixed and Search API v1.1 is now incorporated in the wrapper

Morman answered 21/12, 2012 at 23:18 Comment(2)
I think this is sadly a "non-constructive" question - all the libraries deal differently with how they interact and the approach they take in wrapping the Twitter API (some make it OO, others are just attribute wrappers around API end-points). Sometimes it's just easiest to use requests and an OAuth lib, then couple that with gevent or twisted or whatever for use in storing results in a JSON/BSON database... It just all depends...Orthoepy
It might be not a straightforward question, but still has its justification. I'm looking for advice from Twitter API Hackers, but I'm with you when you say that it is a matter of choice. Still, I lack the knowledge to make a proper choice right now, so I posted this question.Morman
S
0

I've used the sixohsix library before. I have also used tweepy and python-twitter (I found it on github). It's really a matter of preference. I created several virtualenv projects, some that had Django or CherryPy and just tried out different API's until I found the one I was comfortable with. Tweepy seems pretty well documented, but the sixohsix appears to be updated more often.

Suitcase answered 22/12, 2012 at 0:21 Comment(1)
I don't see a lot of documentation about Tweepy, could you post a link to that documentation? The only stuff I saw was about OAuth. But then, is sixohsix's really ported to API 1.1? The github page also lacks documentation about that.Morman

© 2022 - 2024 — McMap. All rights reserved.