Python/Python tableauserverclient
Python tableauserverclient : Sign in & Sign out
CosmosProject
2020. 12. 21. 15:42
728x90
반응형
Tableau Server Client(TSC)
Tableau Server Client(TSC) library gives you various functions to deal with tableau on python code.
Sign in & Sign out
# --------------------------------------------------
# Chapter 1. How to sign in and out in tableau server using TSC
# --------------------------------------------------
import tableauserverclient as TSC
def TSC_sign_in_out():
tableau_server_url = 'tableau_url' # e.g. https://tableau-server.test.com
tableau_user_id = 'tableau_id'
tableau_user_pw = 'tableau_password'
server = TSC.Server(tableau_server_url)
tableau_auth = TSC.TableauAuth(tableau_user_id, tableau_user_pw)
print('Current REST API Version :', server.version)
server.version = '2.8' # You can set tableau server version like this. In this example, version was set as 2.8.
print('Modified REST API Version :', server.version, '\n')
server.auth.sign_in(tableau_auth) # login to tableau server using tableau_auth class
print('Logged in')
# Do something here
server.auth.sign_out() # logout from tableau server
print('Logged out')
Before you use TSC, you should sign in.
728x90
반응형