티스토리 뷰

공부

[tableau] webhook

승가비 2023. 1. 7. 23:54
728x90
from config import TABLEAU
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:
    server.webhooks.delete(i.id)
    print(f"Webhook deleted; {i.name}: {i.id}")

map = {
    # "test": "https://webhook.site/27a0c410-3fc7-4052-beba-dba223847473",
    "stg": "https://stg",
    "prd": "https://prd",
}

for k, v in map.items():
    webhook = TSC.WebhookItem()
    webhook.event = "datasource-refresh-succeeded"
    webhook.name = k
    webhook.url = v
    webhook = server.webhooks.create(webhook)

    print(f"Webhook created; {webhook.name}: {webhook.id}")

https://medium.com/snake-charmer-python-and-analytics/creating-tableau-server-webhooks-to-alert-your-team-when-extracts-fail-or-succeed-7b66a97a968c

 

Creating Tableau Server webhooks to alert your team when extracts fail or succeed

How to set up webhooks using Python and Tableau’s REST API

medium.com

 

728x90

'공부' 카테고리의 다른 글

[hive] merge files  (0) 2023.01.11
[airflow] dag 인식하는 방법  (0) 2023.01.09
[vi] page up & down  (0) 2023.01.07
[python] random.randomrange(start, end, interval)  (0) 2023.01.07
[aws] s3 lifecycle  (0) 2023.01.07
댓글