Skip to content

Instantly share code, notes, and snippets.

@antichaos
Created June 8, 2022 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antichaos/7341a6a9b561ea0d52ce422e6c2fb69f to your computer and use it in GitHub Desktop.
Save antichaos/7341a6a9b561ea0d52ce422e6c2fb69f to your computer and use it in GitHub Desktop.
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