Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

I have installed tableau server on my ubuntu server machine. I'd like to add new users with different roles to that tableau server in python. Is there any way to do that?

closed

1 Answer

0 votes
by (47.2k points)
selected by
 
Best answer
  • Users can be added to your server using a python client library like server-client-python

  • You can add a new user using the User.add method as shown below

import argparse

import getpass

import logging

import tableauserverclient as TSC

parser = argparse.ArgumentParser(description='Creates sample schedules for each type of frequency.')

parser.add_argument('--server', '-s', required=True, help='server address')

parser.add_argument('--username', '-u', required=True, help='username to sign into server')

parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',

                    help='desired logging level (set to error by default)')

args = parser.parse_args()

password = getpass.getpass("Password: ")

tableau_auth = TSC.TableauAuth(args.username, password)

server = TSC.Server(args.server)

# create a new UserItem object.

newU = TSC.UserItem('Monty', 'Publisher')

print(newU.name, newU.site_role)

  • You first take in arguments for the server address, username, and password. Then use the TableauAuth method to authenticate the user. After connecting create a new user object by using the UserItem method passing in the name and role for the user.

Browse Categories

...