Unable to Extract Email address of users through API

pcharugu Registered Posts: 2 ✭✭✭

When I try to extract the user details using the following code.

import dataiku
client = dataiku.api_client()
dss_users = client.list_users()
user_list = []
# Grab list of All users without Email
for user in dss_users:
if user['enabled'] == True:

print (user_list)

I get an error for the line user_list.append(user['email']) saying that email field can't be detected. But if I run the line user_list.append(user) I could see a field called email for all the users. Can you help me finding out how to extract email address for the users being an admin. Attaching the necessary Pictures for your reference.

Operating system used: windows



  • pcharugu
    pcharugu Registered Posts: 2 ✭✭✭

    Attaching the screenshot of the needed field which I get on using user_list.append(user) instead of specific fields

  • Sergey
    Sergey Dataiker, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts Posts: 366 Dataiker

    Hi @pcharugu

    If you need to have a list of users from the administration group with their user profiles, email addresses, you can use this code:

    import dataikuimport pandas as pdclient = dataiku.api_client()dss_users = client.list_users()user_list = []# Grab list of All users without Emailfor user in dss_users:if user['enabled'] == True:if user['groups'] == ['administrators']:try:user_list.append((user['displayName'], user['userProfile'], user['groups'], user['email']))except:breakdf_users = pd.DataFrame(user_list, columns=["User name", "Profile type", "User Groups", "Email address"])print(df_users)

    This will print pandas dataframe with all the details.

Setup Info
      Help me…