0 votes
1 view
in BI by (14.1k 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?

1 Answer

0 votes
by (39.1k 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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...