fastai / ghapi

A delightful and complete interface to GitHub's amazing API
https://ghapi.fast.ai/
Apache License 2.0
610 stars 63 forks source link

fastcore.basics.HTTP403ForbiddenError: HTTP Error 403: Forbidden #44

Closed sharifX closed 3 years ago

sharifX commented 3 years ago

I have using 'search.issues_and_pull_requests' to look some titles of issues in my repo. Using a for loop, I am getting the titles from a csv file which has around 100 issues. I am getting the following error -- sometime I get the error after the 30th item in the list, sometime when I invoke my script. Any ideas?

File "/usr/local/lib/python3.9/site-packages/ghapi/core.py", line 61, in __call__
    return self.client(self.path, self.verb, headers=headers, route=route_p, query=query_p, data=data_p)
  File "/usr/local/lib/python3.9/site-packages/ghapi/core.py", line 104, in __call__
    res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=self.debug, return_headers=True,
  File "/usr/local/lib/python3.9/site-packages/fastcore/net.py", line 175, in urlsend
    return urlread(req, return_json=return_json, return_headers=return_headers)
  File "/usr/local/lib/python3.9/site-packages/fastcore/net.py", line 112, in urlread
    if 400 <= e.code < 500: raise ExceptionsHTTP[e.code](e.url, e.hdrs, e.fp) from None
fastcore.basics.HTTP403ForbiddenError: HTTP Error 403: Forbidden
kequach commented 3 years ago

Did you figure out how to solve this issue? I am encountering the same problem.

sharifX commented 3 years ago

No, unfortunately not. As a workaround, I created a csv file of all the issues then just searched the file instead of using the API.

jph00 commented 3 years ago

Sounds like you might be hitting some rate limits from GitHub. I suggest you insert a sleep in your loop.