<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D50Z00008G7UlISAVOkta Classic EngineIntegrationsAnswered2024-04-17T10:31:53.000Z2017-10-13T23:49:47.000Z2017-10-13T23:49:47.000Z
List all users with Python SDK
I would like to get a list of all users and their user.id from my Okta org via Python. I've tried using the following example but it seems to be very slow (2 hours), I haven't seen it actually complete. Is there a better way to get a list of all active users via Python? My goal is to get all the user id's and then feed that to get_lifecycle_factors to get the enrollment date of the factor.

 

https://github.com/okta/okta-sdk-python/blob/master/docs/quickstart.rst

  
  1.  from okta import UsersClient # http://developer.okta.com/docs/api/getting_started/getting_a_token.html usersClient = UsersClient('My Site',  'My Token) users = usersClient.get_paged_users() while True:  for user in users.result:  print u"Login: {}".format(user.profile.login)  print u"User ID: {}\n".format(user.id)  if not users.is_last_page():  # Keep on fetching pages of users until the last page  users = usersClient.get_paged_users(url=users.next_url)  else:  break
 


  • justin.bergez (Regional Customer Success, Bay Area)

    Hi Andre,

     

    The Python SDK does not do much, other than making a paginated call to list users. It can take hours to pull data, depending on the number of users in your org.

    https://developer.okta.com/docs/api/resources/users.html#list-users.

     

    Justin M. Bergez

    Technical Support Engineer - Tier 2 | Okta, Inc.

    0EM2A000000Du3h

    Expand Post
This question is closed.
Loading
List all users with Python SDK