Survey banner
Share your feedback on the Dataiku documentation with this 5 min survey. Thanks! TAKE THE SURVEY

Python API to get the list of login users from Administration/Security/Users

Solved!
Dominic-S
Level 3
Python API to get the list of login users from Administration/Security/Users

Hi,

  Is there a way to use Dataiku's Python API to get the list of login users info (Login, Type, Groups, etc) posted in Administration/Security/Users?

  Thanks,

0 Kudos
1 Solution
MiguelangelC
Dataiker

Hi,

You can indeed use the Python API to access user related information.

There is a specific section for users and groups that you can check here: https://developer.dataiku.com/latest/api-reference/python/users-groups.html#users-and-groups

For example:

import dataiku
client=dataiku.api_client()
users=client.list_users()
for i in users:
    print("----------")
    myuser=client.get_user(i['login'])
    print("Login name: ",i['login'])
    print("Display name: ",i['displayName'])
    print("Type: ",i['sourceType'])
    try: print("Email: ",i['email'])
    except: print("Email: N/A")
    print("Groups :",i['groups'])
    print("Last successful login: ", myuser.get_activity().last_successful_login)

Feel free to modify this example snippet to suit your business requirements. Please note that depending on your DSS version the exact commands syntax may vary.

View solution in original post

0 Kudos
2 Replies
MiguelangelC
Dataiker

Hi,

You can indeed use the Python API to access user related information.

There is a specific section for users and groups that you can check here: https://developer.dataiku.com/latest/api-reference/python/users-groups.html#users-and-groups

For example:

import dataiku
client=dataiku.api_client()
users=client.list_users()
for i in users:
    print("----------")
    myuser=client.get_user(i['login'])
    print("Login name: ",i['login'])
    print("Display name: ",i['displayName'])
    print("Type: ",i['sourceType'])
    try: print("Email: ",i['email'])
    except: print("Email: N/A")
    print("Groups :",i['groups'])
    print("Last successful login: ", myuser.get_activity().last_successful_login)

Feel free to modify this example snippet to suit your business requirements. Please note that depending on your DSS version the exact commands syntax may vary.

0 Kudos
Dominic-S
Level 3
Author

Thanks, that is exactly what I am looking for.

0 Kudos