Created
June 8, 2022 13:27
-
-
Save antichaos/7341a6a9b561ea0d52ce422e6c2fb69f to your computer and use it in GitHub Desktop.
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
import tableauserverclient as TSC | |
import re | |
tableau_auth = TSC.PersonalAccessTokenAuth('TOKENNAME','TOKENVALUE') | |
server = TSC.Server('TABLEAUSERVER', use_server_version=True) | |
with server.auth.sign_in(tableau_auth): | |
for workbook in TSC.Pager(server.workbooks): | |
# print(workbook.name) | |
if (workbook.name == 'Fiche Generator'): | |
server.workbooks.populate_views(workbook) | |
print("\nThe views for {0}: ".format(workbook.name)) | |
print(workbook.id) | |
for view in workbook.views: | |
image_req_option = TSC.ImageRequestOptions(imageresolution=TSC.ImageRequestOptions.Resolution.High, maxage=1) | |
image_req_option.vf('SelectedCountry', 'Belgium') | |
server.views.populate_image(view, image_req_option) | |
view_image_name = view.name + ".png" | |
print(view.name) | |
with open(view_image_name, 'wb') as f: | |
f.write(view.image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment