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
PaginatedList.totalCount KeyError: 'page' with large results #1006
Comments
Maybe, From the list-all-public-repositories API doc.
It not support |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue could be related to the way that PaginatedList.py parses parse_qs is executed using a full url. It fails parsing first parameter (rigth after >>> from urllib.parse import parse_qs
>>> parse_qs("https://github.com/Cobliteam/?page=11")
{'https://github.com/Cobliteam/?page': ['11']}
>>> parse_qs("https://github.com/Cobliteam/?per_page=3&page=11")
{'https://github.com/Cobliteam/?per_page': ['3'], 'page': ['11']} Could this bug be reopened? Or should I open a new issue? |
Hey, just got stung by this. Anyone since managed to find a solution? |
Never seen this, reopening this issue for tracking. |
I've had a few tackles with this issue, it reappears more when using the lazy=True when creating the repo object (as an example - r = g.get_repo('docker/docker', lazy=True); c = r.get_contributors(anon='true'); c.totalCount An easy fix could be in the function totalCount in the line self.__totalCount = int(parse_qs(lastUrl)["page"][0]) |
When using get_repo().totalCount on a small result set (only my own repositories) totalCount returns the repository count correctly. When querying my enterprise Github for a complete list of repositories, the following error occurs:
I am using Python 3.7.1 and the pip-installed version 1.43.4 of PyGithub with a Github Enterprise version 2.14.7.
This is the code I have used to test this:
I did notice, after some skimming of PaginatedList.py, that the Link headers differ between the two tests. When collecting just my own repositories, I see the "last" link returned in the link header, but when querying for all repositories I only see "next" and "first" links returned.
g.get_user().get_repos():
g.get_repos():
'link':'<https://mygithubhost.lads/api/v3/repositories?per_page=1&since=112>; rel="next", <https://mygithubhost.lads/api/v3/repositories{?since}>; rel="first"'
I don't know what's causing this difference in behavior, though.
If I don't try to get totalCount from the object, it works as expected, but totalCount specifically seems to fail.
The text was updated successfully, but these errors were encountered: