Description
Hello,
I have a python script utilizing the Tableau Server Client (TSC). I am trying to pull down information about the users. Below is the code, slightly modified from the example given online from the Tableau Github page (https://tableau.github.io/server-client-python/docs/api-ref#requests).
Just to be clear...I am using a server administrator account to pull the data.
Using the link above as a reference, scroll down to “Users”. Just below will show the attributes available in the UserItem class. You will see 'name', site_role','fullname' and 'email' are included in that list.
When I try to query the API for 'fullname' and 'email' I get “None”. According to documentation Tableau populates the email address and display name with info from AD during import. When I log into Tableau, the two fields are populated as expected. But as stated, when I do a pull using TSC, it pulls back nothing. I don’t think it’s my code as I am not getting errors. And I am using two other attributes (name and site_role) that both pull back the correct information when queried. See below for the code I am using.
---Works---
with server.auth.sign_in(tableau_auth):
all_users, pagination_item = server.users.get()
UsersDB = [(user.name,user.site_role) for user in all_users]
What I want to do is include 'user.fullname' and 'user.email' in the above query. But when I do I get "None" as my results for those two attributes only, 'user.name' and 'user.site_role' both pull back data.
---Does not work correctly----
with server.auth.sign_in(tableau_auth):
all_users, pagination_item = server.users.get()
UsersDB = [(user.fullname,user.name,user.site_role,user.email) for user in all_users]
SIDE NOTE: I have been reviewing the user_item.py file to see if something was overlooked. I am NOT an expert with classes so I am not really sure what am looking at. However I don't think properties were declared for email and full name. I tried added them and get errors saying things like "inconsistent use of tabs and spaces in indentation". When I replace and existing property to avoid this error I get an error saying "can't set attribute". So I obviously don't understand this file. I need this information for a work project.
Here is the file I was reviewing....
https://github.com/tableau/server-client-python/blob/master/tableauserverclient/models/user_item.py
I was messing with "def init" and the '@properties' below it.
Please advise.
EDIT:
SIDE NOTE clear up - I figured out the tabs and spacing issue. Apparently it didn't like it when I tabbed for indentation. So I put 4 spaces every for my issues and it solved that issue.
Once I cleared up that, I get an error like "fullname must not be empty".