{"action":"created","issue":{"url":"https://api.github.com/repos/PyGithub/PyGithub/issues/415","repository_url":"https://api.github.com/repos/PyGithub/PyGithub","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/415/labels{/name}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/415/comments","events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/415/events","html_url":"https://github.com/PyGithub/PyGithub/issues/415","id":163510741,"number":415,"title":"github.PaginatedList.PaginatedList totalCount return None","user":{"login":"GrapeBaBa","id":3657859,"avatar_url":"https://avatars2.githubusercontent.com/u/3657859?v=4","gravatar_id":"","url":"https://api.github.com/users/GrapeBaBa","html_url":"https://github.com/GrapeBaBa","followers_url":"https://api.github.com/users/GrapeBaBa/followers","following_url":"https://api.github.com/users/GrapeBaBa/following{/other_user}","gists_url":"https://api.github.com/users/GrapeBaBa/gists{/gist_id}","starred_url":"https://api.github.com/users/GrapeBaBa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrapeBaBa/subscriptions","organizations_url":"https://api.github.com/users/GrapeBaBa/orgs","repos_url":"https://api.github.com/users/GrapeBaBa/repos","events_url":"https://api.github.com/users/GrapeBaBa/events{/privacy}","received_events_url":"https://api.github.com/users/GrapeBaBa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-07-02T09:38:17Z","updated_at":"2018-04-13T03:02:06Z","closed_at":null,"author_association":"NONE","body":"My question is why invoking totalCount directly return None, but iterate will get the number.\n\n``` python\n            repo_commits = repo.get_commits()\n            repo_total = 0\n            for _ in repo_commits:\n                repo_total = repo_total + 1\n```\n\n``` python\n            repo_total = repo.get_commits().totalCount\n```\n"},"comment":{"url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments/381007269","html_url":"https://github.com/PyGithub/PyGithub/issues/415#issuecomment-381007269","issue_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/415","id":381007269,"user":{"login":"sfdye","id":1016390,"avatar_url":"https://avatars2.githubusercontent.com/u/1016390?v=4","gravatar_id":"","url":"https://api.github.com/users/sfdye","html_url":"https://github.com/sfdye","followers_url":"https://api.github.com/users/sfdye/followers","following_url":"https://api.github.com/users/sfdye/following{/other_user}","gists_url":"https://api.github.com/users/sfdye/gists{/gist_id}","starred_url":"https://api.github.com/users/sfdye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfdye/subscriptions","organizations_url":"https://api.github.com/users/sfdye/orgs","repos_url":"https://api.github.com/users/sfdye/repos","events_url":"https://api.github.com/users/sfdye/events{/privacy}","received_events_url":"https://api.github.com/users/sfdye/received_events","type":"User","site_admin":false},"created_at":"2018-04-13T03:02:06Z","updated_at":"2018-04-13T03:02:06Z","author_association":"COLLABORATOR","body":"Looking at a few related issues #433 #487 #596\r\n\r\nI guess the `total_count` is from the old Github API response? Shall we remove the `TotalCount` attribute on `PaginatedList` since its implementation is broken and always returns `None`. Instead, we could add something in the docs like:\r\n```\r\n# To get the total number of available elements in PaginatedList\r\nrepos = g.get_user().get_repos()\r\nprint(len(list(gists)))  # we can't avoid to iterate through the whole set to get total count\r\n```\r\n\r\nAnd maybe we can implement the `__len__` to return the current elements count?"}}
{"actor":{"display_login":"sfdye"}}