You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed the same with list_groups. Actually the first and second batch are okta.models.group.Group objects, from the third it's a dict. When I print the type and list groups with limit=1, then I get:
for group in groups_list:
# Weird Okta SDK behavior: it returns objects at the first and second request, and dicts at the third request
if hasattr(group, 'as_dict'):
groups.append(group.as_dict())
elif isinstance(group, dict):
groups.append(group)
This feels very crappy, but I have no other solution at this point :(
comrumino
pushed a commit
to comrumino/okta-sdk-python
that referenced
this issue
Mar 14, 2025
I am very new to this, but my while loop based on your example for pagination seems to always return true.
I think it's because resp always has a "ref=next", even if that url referenced is the object itself.
https://xyz.server.com/api/v1/users?after=XYXYXYXYXXYXY&limit=1; rel="next"
is returned from : https://xyz.server.com/api/v1/users?limit=1
query_parameters = {'limit': '1'}
users, resp, err = await client.list_users(query_parameters)
Check if there more pages follow
if resp.has_next():
users, err = await resp.next() # Returns list of 1 user after the last retrieved user
Iterate through all of the rest of the pages
while resp.has_next():
users, err = await resp.next()
Do stuff with users in users
print(resp.has_next()) # False
try:
await resp.next()
except StopAsyncIteration:
Handle Exception raised
The text was updated successfully, but these errors were encountered: