Pagination Broke. ghapi 1.0.3
yourcodeishotgarbage opened this issue · 1 comments
yourcodeishotgarbage commented
Python 3.9.17 ghapi 1.0.3
No pagination, works fine
repos = api.repos.list_for_org(org=GITHUB_USER_OR_ORG,per_page=100)
print(len(repos),repos[0].name)
Output:
100 myrepo
With pagination:
repos = paged(api.repos.list_for_org(org=GITHUB_USER_OR_ORG,per_page=100))
print(len(repos),repos[0].name)
Output:
TypeError: object of type 'generator' has no len()
I also do not see anywhere in the documentation to use:
from ghapi.page import paged
I had to find it on some other random example.
You would have thought from ghapi.all import GhApi
implies ALL but silly me.
jph00 commented
A generator in python doesn't have a length. Wrap it in list
if you want it's length. To import all symbols from a module, use from module import *
.