Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get followers ID's raised Rate Limited exceeded with sleep on wait limit #512

Closed
zrothberg opened this issue Oct 6, 2017 · 2 comments
Closed

Comments

@zrothberg
Copy link

zrothberg commented Oct 6, 2017

I am using the pip version but the code in my stacktrace does not appear to have changed since then. It appears as if a simple sleep on the error would have fixed the problem but I was under the impression it was already doing that. The program was running for 6-12 hours before it crashed. I do not know if this is a bug or If there is a way to handle the error and have it resume easily.

	api = twitter.Api(consumer_key=Consumer_key, consumer_secret=Consumer_secret,
	                  access_token_key=Access_token, access_token_secret=Access_token_secret,
	                  sleep_on_rate_limit=True)
	accounts = ["JakeWarden","Zendaya"]


	def profilenewaccounts(accountlist):
	    for item in accountlist:
	        data = api.GetFollowerIDs(screen_name=item)

	        with open(item+".txt", 'w') as f:
	            for s in data:
	                f.write(str(s) + '\n')

	        print(item +"  done")


	profilenewaccounts(accounts)

and here is the stack trace

  JakeWarden  done
  Traceback (most recent call last):
    File "/Users/zacharyrothberg/PycharmProjects/twitterbotffs/MainBot.py", line 34, in <module>
      profilenewaccounts(accounts)
    File "/Users/zacharyrothberg/PycharmProjects/twitterbotffs/MainBot.py", line 25, in profilenewaccounts
      data = api.GetFollowerIDs(screen_name=item)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twitter/api.py", line 2464, in GetFollowerIDs
      total_count=total_count)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twitter/api.py", line 2412, in _GetFriendFollowerIDs
      count=count)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twitter/api.py", line 2290, in _GetIDsPaged
      data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twitter/api.py", line 4894, in _ParseAndCheckTwitter
      self._CheckForTwitterError(data)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/twitter/api.py", line 4914, in _CheckForTwitterError
      raise TwitterError(data['errors'])
  twitter.error.TwitterError: [{'message': 'Rate limit exceeded', 'code': 88}]
@jeremylow
Copy link
Collaborator

This is usually something going on with Twitter and their edge servers returning inconsistent rate limits. See issue #350 . We try as best we can, but I'd suggest a try: / except block around your function if this is going to be a long-running operation.

@zrothberg
Copy link
Author

And I assume use the page driven call instead of the getfollowerids one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants