I’m trying to query tweet using tweepy by tweet ids (about 2300 ids)
but i can only query around 185 ids each time and then have to wait for 15mins, which means that 2300 ids will take about 3 hrs to complete.
the api im using is:
consumer_key = 'xxxxxx'
consumer_secret = 'xxxxxx'
access_token = 'xxxxxxxx'
access_secret = 'xxxxxx'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_secret)
api = tweepy.API(auth,wait_on_rate_limit=True,wait_on_rate_limit_notify=True)
then loop through each id in tweet_id with api.get_status method
I did google around and turns out that possibly app-only queries allows more request within 15min windows, can anyone please point out how can i make an app-only request with tweepy ?
thanks
2
Answers
I believe you can do application only authentication with tweepy 2.0
Read this: https://shogo82148.github.io/blog/2013/05/09/application-only-authentication-with-tweepy/
I hope this helped!
You can use the
statuses_lookup
(tweepy docs, twitter docs) instead, and pass up to 100 ids per call. The limit with using this method is 300 requests according to the rate limits page. That is, you could get 300×100=30000 tweets before reaching the window limit and having to wait for 15 minutes. Your 2300 ids would be collected really quick.Hope it helps
UPDATE to answer comment:
From the Twitter docs:
So you won’t really get an error, but you may not get the tweet. So you would want to compare the returned results against your ID list to see which tweet was not returned.