[tableau] workbook & webhook & auth (sign_in, sign_out)
import tableauserverclient as TSC
SITE_LUID = "..."
auth = TSC.PersonalAccessTokenAuth(
TABLEAU["TOKEN_NAME"],
TABLEAU["TOKEN_VALUE"],
)
server = TSC.Server(
TABLEAU["SERVER_URL"],
use_server_version=True
)
server.auth.sign_in(auth)
for w in TSC.Pager(server.workbooks):
server.workbooks.populate_connections(w)
for c in w.connections:
if c.datasource_id == SITE_LUID:
server.workbooks.populate_views(w)
for v in w.views:
print(v.name)
import tableauserverclient as TSC
auth = TSC.PersonalAccessTokenAuth(
TABLEAU["TOKEN_NAME"],
TABLEAU["TOKEN_VALUE"],
)
server = TSC.Server(
TABLEAU["SERVER_URL"],
use_server_version=True
)
server.auth.sign_in(auth)
list, _ = server.webhooks.get()
for i in list:
print(f"{i.name}: {i.id}")
# webhook = TSC.WebhookItem()
# webhook.name = "name"
# webhook.event = "datasource-refresh-succeeded"
# webhook.url = "https://0.0.0.0/tableau/v1/webhook"
# webhook = server.webhooks.create(webhook)
# print(f"Webhook created; {webhook.name}: {webhook.id}")
# server.webhooks.delete("...")
@staticmethod
def _sign_in():
server = TableauService._server()
auth = TSC.PersonalAccessTokenAuth(
TABLEAU["TOKEN_NAME"],
TABLEAU["TOKEN_VALUE"],
)
server.auth.sign_in(auth)
return server
@staticmethod
def _sign_out(server):
server.auth.sign_out()
https://help.tableau.com/current/developer/webhooks/en-us/docs/webhooks-events-payload.html
Webhooks Events and Payloads
Webhooks Events and Payloads In this topic: Trigger Events Note: Starting in Tableau 2020.3, the `event` attribute of your webhook is the preferred place to specify the triggering event. `webhook-source` can also be used or omitted, as long as there is no
help.tableau.com
https://tableau.github.io/server-client-python/docs/api-ref#workbookitem-class
API reference
tableau.github.io
https://cosmosproject.tistory.com/86
Python tableauserverclient : Sign in & Sign out
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 usi
cosmosproject.tistory.com