ghapi icon indicating copy to clipboard operation
ghapi copied to clipboard

paged loop forever when used with repos.get_commit

Open tetienne opened this issue 2 years ago • 1 comments

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?

tetienne avatar Oct 21 '21 09:10 tetienne

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.

dtaivpp avatar Oct 21 '21 17:10 dtaivpp