Skip to content

Commit

Permalink
OKTA-672843: include response object in call to next() during paging
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanapellanes-okta committed Dec 7, 2023
1 parent 840e2a6 commit 1c64f84
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions okta/api_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@ async def next(self):
# if not self.has_next():
# return (None, None) #This causes errors with our async testing
MODELS_NOT_TO_CAMEL_CASE = [User, Group, UserSchema, GroupSchema]
next_page, error = await self.get_next().__anext__()
next_page, error, next_response = await self.get_next().__anext__()
if error:
return (None, error)
if self._type is not None:
result = []
for item in next_page:
result.append(self._type(item) if self._type in MODELS_NOT_TO_CAMEL_CASE
else self._type(APIClient.form_response_body(item)))
return (result, None)
return (result, None, next_response)

return (next_page, error)
return (next_page, error, next_response)

async def get_next(self):
"""
Expand Down Expand Up @@ -177,4 +177,4 @@ async def get_next(self):
self._request_executor, req, res_details, resp_body)
self._next = next_response._next
# yield next page
yield (next_response.get_body(), None)
yield (next_response.get_body(), None, next_response)

0 comments on commit 1c64f84

Please sign in to comment.