mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Correctly deal when PaginatedList's data is a dict (#2084)
When calculating totalCount for a PaginatedList, if a Link header is not in the returned data, we use len() to calculate the number of items. PullRequest.get_review_requests() actually returns a dictionary, which neatly defeats this naive method. Peer inside the dictionary in this case, and add a test case. Fixes #2053
This commit is contained in:
@@ -153,6 +153,8 @@ class PaginatedList(PaginatedListBase):
|
||||
if data and "total_count" in data:
|
||||
self.__totalCount = data["total_count"]
|
||||
elif data:
|
||||
if isinstance(data, dict):
|
||||
data = data[self.__list_item]
|
||||
self.__totalCount = len(data)
|
||||
else:
|
||||
self.__totalCount = 0
|
||||
|
||||
Reference in New Issue
Block a user