Use the Tableau Server Client (TSC) library to increase your productivity as you interact with the Tableau Server REST API. Withthe TSC library you can do almost everything that you can do with the REST API, including:
If you need help or to report issues, refer to theGetting Help page.
This page describes how to:
Before you install TSC, confirm that you have the following dependencies installed:
You can install TSC with pip or from the source code.
Run the following command to install the latest stable version of TSC:
pipinstall--upgrade pippipinstalltableauserverclientYou can install from the development branch for a preview of upcoming features. Run the following commandto install from the development branch:
pipinstallgit+https://github.com/tableau/server-client-python.git@developmentNote that the version from the development branch should not be used for production code. The methods and endpoints in thedevelopment version are subject to change at any time before the next stable release.
To install TSC onto a machine without an internet connection, use the following steps:
1) Ensure that Python is installed.
2) Download and manually install therequests Python library (and its dependencies).
3) Download thesetup package.
4) Runpip install ./tableauserverclient-x.y.tar.gz
The TSC samples are included in thesamples directory of the TSC repository on Github. You can run the following command to clone therepository:
git clone git@github.com:tableau/server-client-python.gitFor more information on the samples and how to run the samples, seeSamples.
Run the following code to get a list of all the data sources on your installation of Tableau Server:
importtableauserverclientasTSCtableau_auth=TSC.TableauAuth('USERNAME','PASSWORD','SITENAME')server=TSC.Server('http://SERVER_URL')withserver.auth.sign_in(tableau_auth):all_datasources,pagination_item=server.datasources.get()print("\nThere are {} datasources on site: ".format(pagination_item.total_available))print([datasource.namefordatasourceinall_datasources])SERVER_URL is the URL of your Tableau server without subpaths. For local Tableau servers, an example would be:https://www.MY_SERVER.com. For Tableau Cloud, an example would be:https://10ax.online.tableau.com/.
SITENAME is the subpath of your full site URL (also calledcontentURL in the REST API).MYSITE would be the site name ofhttps://10ax.online.tableau.com/MYSITE. This parameter can be omitted when signing in to the Default site of a on premise Tableau server.
SeeSign In and Out for more details about the sign in & out options.