fastai / ghapi

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

paged loop forever when used with repos.get_commit #98

Open tetienne opened 2 years ago

tetienne commented 2 years ago

The following code will loop forever:

api = GhApi(owner="fastai", repo="ghapi", token=os.environ["GH_TOKEN"])
pages = paged(api.repos.get_commit, "d8fb5c28e14f4bcbb0691e71b4ef7d55228a81ac")
for page in pages:
    print("foo")
foo
foo
foo

Whatever the commit I target, I got the same behavior.

I’m doing something wrong, or it’s a real bug?

dtaivpp commented 2 years ago

Hey @tetienne check out my issue #96. I had the same issue with search.code. I have a function that should work for pagination there. The issue is GitHub sends back data even when there are no results and their built-in function doesn't know how to handle that.

Hopefully we can get an update soon on how to resolve this. I'd make a PR myself but I dont really understand how fastai generates the code.