Closed yourcodeishotgarbage closed 3 months ago
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
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()
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.
from ghapi.page import paged
You would have thought from ghapi.all import GhApi implies ALL but silly me.
from ghapi.all import GhApi
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 *.
list
from module import *
Python 3.9.17 ghapi 1.0.3
No pagination, works fine
Output:
100 myrepo
With pagination:
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.