-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Org Repository Pagination Only Returns First Page #2963
Comments
As of today with Python 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> from github import Github
>>> github = Github(os.getenv('GITHUB_TOKEN'))
>>> repos = github.get_organization('microsoft').get_repos(sort='full_name', type='all')
>>> assert repos.totalCount > 50
>>> assert len(repos.get_page(1)) != 0
>>> repos.totalCount
6212
>>> len(repos.get_page(1))
30 I'm thinking it could be about the token permissions and repository visibility as mentioned in the docs
Maybe your token could list 50 public repos, but not the others? Seems too much of a coincidence, but just trying to throw some light |
I just noticed that you don't use a token in your example, which I assumed you'd since you do not provide organization name, but I get the same result without a token. Python 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from github import Github
>>> github = Github()
>>> repos = github.get_organization('microsoft').get_repos(sort='full_name', type='all')
>>> assert repos.totalCount > 50
>>> assert len(repos.get_page(1)) != 0
>>> repos.totalCount
6212
>>> len(repos.get_page(1))
30 |
@squatched can you confirm pagination works with a token? |
My org has hundreds of repositories, but when I call
Github().get_organization(org_slug).get_repos(sort="full_name", type="all")
, the resulting object only ever has at most 50 objects in it (repos.totalCount
is 50 as well as the size of the resultingget_page(0)
) and when I try and get any page other than1
, I get an empty list returned.I would expect this to work:
The text was updated successfully, but these errors were encountered: