Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Tweepy to Access Twitter's Premium API

I want to access Twitter's archive without being restricted by rate limits or number of queries. I don't mind paying for this, so my plan was to sign up for the premium package on Twitter's API platform. As I'm familiar with Tweepy, I had hoped to be able to access the API in my usual way.

However, it seems that the only way I can query the API with premium credentials in Python is through the Python Twitter Search API, which is basically a python wrapper for the premium service. The issue is that the authentication protocols for premium access are not the same as for the rate-limited free access. This is most annoying, as the searchtweets library that supports the Python Twitter Search API seems fairly primitive, and I can make practically no sense of the docs.

Does anyone know whether it is possible to use Tweepy to access premium tier for Twitter? It's kinda weird that the better tools only work on the free tier.

like image 896
Lodore66 Avatar asked May 10 '18 12:05

Lodore66


People also ask

Is it possible to access tweepy's API with premium credentials?

As I'm familiar with Tweepy, I had hoped to be able to access the API in my usual way. However, it seems that the only way I can query the API with premium credentials in Python is through the Python Twitter Search API, which is basically a python wrapper for the premium service.

How do I use the Twitter API?

The Twitter API allows you to do many things including retrieve tweet data. In order to access this data, you need a developer account. Using the Twitter API should be an easy thing, but sometimes pictures and simple code can save you some frustration. 1.) Create a twitter account if you do not have one.

How to reply to a tweet using tweepy V2?

21. Replying to a Tweet If you want to reply to a Tweet with Tweepy using the Twitter API v2, in the create_tweet method, you can simply pass the in_reply_to_tweet_id with the ID of the Tweet that you want to reply to, as shown below: These are some common examples of working with the Twitter API v2 using Tweepy.

What is tweepy and why should I Care?

What is Tweepy? The Twitter API exposes dozens of HTTP endpoints that can be used to retrieve, create and delete tweets, retweets and likes. It provides direct access to rich and real-time tweet data, but requires having to deal with a lot of low level details (and very not fun debugging).


1 Answers

That is not true. You can use the same credentials (assuming you get authorized by Twitter) for both the Standard Search and the Premium Search.

The TwitterAPI python wrapper supports both -- https://github.com/geduldig/TwitterAPI

from TwitterAPI import TwitterAPI
api = TwitterAPI(consumer_key, consumer_secret, access_token_key, access_token_secret)
r = api.request('tweets/search/fullarchive/:YOUR_LABEL',
                {'query':YOUR_SEARCH_TERMS})
for item in r:
    print(item)
like image 67
Jonas Avatar answered Sep 22 '22 00:09

Jonas