First I want list of sites then next I want list of projects inside each site and then I want list of workbook in each project.
i.e sites>>projects>>workbooks.
I am using Tableauserverclient. Please help me, thanks in advance.
Check out Tableau's github page. It has all the examples.
I would consider using Tableau's workgroup database though unless you are requiring python for some other action.
Sites
import tableauserverclient as TSC
tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD')
server = TSC.Server('https://SERVER')
# query the sites
all_sites, pagination_item = server.sites.get()
# print all the site names and ids
for site in all_sites:
print(site.id, site.name, site.content_url, site.state)
Projects
import tableauserverclient as TSC
tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD', site_id='CONTENTURL')
server = TSC.Server('https://SERVER')
with server.auth.sign_in(tableau_auth):
# get all projects on site
all_project_items, pagination_item = server.projects.get()
print([proj.name for proj in all_project_items])
Workbooks
import tableauserverclient as TSC
tableau_auth = TSC.TableauAuth('username', 'password', site_id='site')
server = TSC.Server('https://servername')
with server.auth.sign_in(tableau_auth):
all_workbooks_items, pagination_item = server.workbooks.get()
# print names of first 100 workbooks
print([workbook.name for workbook in all_workbooks_items])