mozilla/agithub

Reaching a rate limit with pagination causes error

gene1wood opened this issue · 0 comments

If you set paginate to True and leaving sleep_on_ratelimit as the default, you can get this error message.

Traceback (most recent call last):
  File "/path/to/__init__.py", line 53, in <module>
    status, data['refs_map'][repo['name']] = g.repos[org_name][repo['name']].git.refs.get()
  File "/path/to/.venv/lib/python3.6/site-packages/agithub/base.py", line 157, in get
    return self.request('GET', url, None, headers)
  File "/path/to/.venv/lib/python3.6/site-packages/agithub/GitHub.py", line 115, in request
    data.extend(self.get_additional_pages(method, bodyData, headers))
  File "/path/to/.venv/lib/python3.6/site-packages/agithub/GitHub.py", line 127, in get_additional_pages
    status, data = self.request(method, url, bodyData, headers)
  File "/path/to/.venv/lib/python3.6/site-packages/agithub/GitHub.py", line 115, in request
    data.extend(self.get_additional_pages(method, bodyData, headers))
  File "/path/to/.venv/lib/python3.6/site-packages/agithub/GitHub.py", line 127, in get_additional_pages
    status, data = self.request(method, url, bodyData, headers)
...
  File "/path/to/.venv/lib/python3.6/site-packages/agithub/GitHub.py", line 115, in request
    data.extend(self.get_additional_pages(method, bodyData, headers))
  File "/path/to/.venv/lib/python3.6/site-packages/agithub/GitHub.py", line 140, in get_additional_pages
    'was returned with status {}: {}'.format(status, data))
TypeError: While fetching a paginated GitHub response page, a non-list was returned with status 403: {'message': "API rate limit exceeded for 1.2.3.4. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", 'documentation_url': 'https://developer.github.com/v3/#rate-limiting'}