Last active
November 2, 2021 21:42
-
-
Save divinorum-webb/f32a0ddb233b7cc8cf91ad7e8a215dd1 to your computer and use it in GitHub Desktop.
tableau-api-lib-create-subscription
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils.querying import get_schedules_dataframe, get_users_dataframe, get_views_dataframe | |
SAMPLE_SCHEDULE_ID = <YOUR_SCHEDULE_ID> | |
SAMPLE_USER_ID = <USER_ID_FOR_USER_SUBSCRIBED> | |
SAMPLE_CONTENT_ID = <VIEW_OR_WORKBOOK_ID_FOR_SUBSCRIPTION> | |
SAMPLE_CONTENT_TYPE = <VIEW_OR_WORKBOOK> # this value can 'view' or 'workbook' and is not case sensitive | |
tableau_server_config = { | |
'my_env': { | |
'server': 'https://YourTableauServer.com', | |
'api_version': '<YOUR_API_VERSION>', | |
'username': '<YOUR_USERNAME>', | |
'password': '<YOUR_PASSWORD>', | |
'site_name': '<YOUR_SITE_NAME>', | |
'site_url': '<YOUR_SITE_CONTENT_URL>' | |
} | |
} | |
conn = TableauServerConnection(tableau_server_config, env='my_env') | |
conn.sign_in() | |
print(help(conn.create_subscription)) # this demos the useful info contained within each tableau-api-lib method's docstring | |
response = conn.create_subscription(schedule_id=SAMPLE_SCHEDULE_ID, | |
user_id=SAMPLE_USER_ID, | |
content_type='view', | |
content_id=SAMPLE_CONTENT_ID, | |
subscription_subject='Sample subscription subject', | |
attach_pdf_flag=True, | |
attach_image_flag=True) | |
print(response.json()) | |
conn.sign_out() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am creating automatic subscribtion for tableu server using this script but getting issue while running script