Eleanor Abernathy
Eleanor Abernathy

Reputation: 1

Use Tweepy with the new Twitter API (OAuth2) and academic account?

apparently Tweepy now is supporting OAuth 2 (link). However when I try to use it still, I cannot pas the 3200 tweets limit (altough I have an academic account). Any hint on what I’m doing wrong?

consumer_key    = 'xxxxxx'
consumer_secret = 'xxxxxxxxxxx'
auth = tweepy.AppAuthHandler(consumer_key, consumer_secret)
api = tweepy.API(auth)

text_list, date =([] for i in range(2))
for user in tweepy.Cursor(api.user_timeline, id="snow", tweet_mode='extended', count=200).items():
    text_list.append(user.full_text)
    date.append(user.created_at)

Upvotes: 0

Views: 1078

Answers (1)

anon
anon

Reputation:

Twitter has supported the client credentials flow of OAuth 2.0 since at least 2012. This provides for “anonymous” / application-only access to API resources. Tweepy has also supported this for a long time.

(note: Twitter and Tweepy do not yet support OAuth 2.0 for user authentication in general, at the time of posting; but this is being worked on by Twitter)

I cannot pass the 3200 tweets limit (although I have an academic account).

Two issues:

  • you’re using the current version of Tweepy, which only supports the API v1.1 (at this time), and the Academic Access for the API is brand new and only supports v2. You must have an Academic project in the Twitter developer portal, with an associated application.
  • you’re calling the user timeline API. That’s limited to a 3200 Tweet history for a user timeline, which is why you’re seeing this. The Academic Access is for full archive search, not for user timelines. Can you explain what you have read that says that you would have unlimited user timeline access as an Academic user? (this could help us to correct any documentation that is confusing)

You should review what you’ve applied for, and what the Twitter API provides.

I’d suggest that the Twitter Developer Forums might be the best place to get specific advice.

Upvotes: 1

Related Questions