Twitter-Sentiment-Analysis icon indicating copy to clipboard operation
Twitter-Sentiment-Analysis copied to clipboard

API call limit

Open tczee36 opened this issue 5 years ago • 1 comments

How to avoid the following error?

Traceback (most recent call last): File "tweet.py", line 30, in for tweet in tweets: File "/usr/local/lib/python3.7/dist-packages/tweepy/cursor.py", line 49, in next return self.next() File "/usr/local/lib/python3.7/dist-packages/tweepy/cursor.py", line 197, in next self.current_page = self.page_iterator.next() File "/usr/local/lib/python3.7/dist-packages/tweepy/cursor.py", line 108, in next data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kargs) File "/usr/local/lib/python3.7/dist-packages/tweepy/binder.py", line 250, in _call return method.execute() File "/usr/local/lib/python3.7/dist-packages/tweepy/binder.py", line 234, in execute raise TweepError(error_msg, resp, api_code=api_error_code) tweepy.error.TweepError: Twitter error response: status code = 429

thanks

tczee36 avatar Mar 11 '19 15:03 tczee36

Add wait_on_rate_limit=True on the API call like this:

api = tweepy.API(auth, wait_on_rate_limit=True) This will make the rest of the code obey the rate limit

rohanvivek avatar Mar 18 '21 17:03 rohanvivek