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
requests
and an OAuth lib, then couple that withgevent
ortwisted
or whatever for use in storing results in a JSON/BSON database... It just all depends... – Orthoepy