Hey Barbara, I think the reason that you're getting a syntax error is because you're missing a closing parenthesis on line 5 where you add a filter to your request options object. Use this instead:
Thanks. That fixed my original issue and was definitely an issue in the original sample code as well.
I'm now stuck with an Index error. Here's my code:
tableau_auth = TSC.TableauAuth(user_name, password)
server = TSC.Server(server_name)
# Open csv file and read records
csvRows = 
csvFile = open('TabAdminCsv.csv')
csvReader = csv.reader(csvFile)
for row in csvReader:
continue #skip first row
print('Row #' + str(csvReader.line_num)+' '+ str(row))
username = "'"+(row)+"'"
req_option = TSC.RequestOptions()
matching_users, pagination_item = server.users.get(req_option)
The error I'm getting is
IndexError: list index out of range
I'm still using sample code as my source
1 of 1 people found this helpful
Barbara, based on the error "list index out of range", my suspicion is that your "matching_users" list isn't filled with data. That likely means that the API call isn't returning a successful 200 code and would start trying to isolate that.
Can I request that this info (Specifically, the code to build a request option) be added to the github documentation (https://github.com/tableau/server-client-python/blob/master/docs/docs/api-ref.md)? It currently refers to the request option 7 times, but is totally unclear about what constitutes a valid request option, the method by which to create a valid request option, and is easily confused with python's "requests" library.