SIGN IN
tableau_auth = TSC.TableauAuth(args.username, password, args.site)
server = TSC. Server(args.server, use_server_version=True)
with server.auth.sign_in(tableau_auth):
print("Your server contains the following sites:")
for site in TSC.Pager(server.sites.get):
print(site.name)
i=input("Enter the site name :")
print(i)
for project in TSC.Pager(server.sites.projects.get):
print(project.name)
在 Tableau 服务器客户端中,我可以根据打印项目和工作簿所需的站点 ID 打印站点 ID。在上面的代码中,用户获取站点ID属于他的角色的列表,用户选择站点ID,并且我已根据站点名称存储在对象" i"中,如何向下钻取到项目和工作簿。
这是我在site_id后的做法
auth = TSC.TableauAuth('username', 'password', site_id=i)
server = TSC.Server(serverAddress)
with server.auth.sign_in(auth):
all_project_items, pagination_item = server.projects.get()
for proj in all_project_items:
print(proj.id)
all_workbooks, pagination_item = server.workbooks.get()
for workbook in all_workbooks:
print(workbook.name)