server-client-python
server-client-python copied to clipboard
[New functionality]: How to make request directly using token other than a TableauAuth or a PersonalAccessTokenAuth
Description
In a multi-thread occasion, sign in with PersonalAccessTokenAuth will always reset the token. Is there any way to store the token else where and use the token header directly without PersonalAccessTokenAuth again?
Hello Mattholy,
You can use the token header details with site, user, token as below.
if name == 'main':
# Authenticate Initially
tableauAuth = TSC.TableauAuth(username, password)
server1 = TSC.Server(server_name, http_options={"verify": False})
server1.auth.sign_in(tableauAuth)
print(server1.users.get()[0][0])
site, user, token = server1.site_id, server1.user_id, server1.auth_token
# Reuse site, user, token
server2 = TSC.Server(server_name, http_options={"verify": False})
server2._set_auth(site, user, token)
print(server1.datasources.get()[0][0])