我正在通过使用python中的tableau服务器客户端通过tableau服务器将工作簿导出到本地驱动器。我可以导出一些工作簿,但是有一些Tableau工作簿可以导出,并且出现诸如400080的错误:错误的请求
导入操作系统 将tableauserverclient导入为TSC
tableau_auth = TSC.TableauAuth('****', '*****', site_id="")
server = TSC.Server('https://****.net')
server.use_server_version()
tag_to_filter ='Summary'
new_folder_path = 'C:\\Users\\User\\Desktop\\Tableau\\TSC'
with server.auth.sign_in(tableau_auth):
req_option = TSC.RequestOptions().page_size(300)
all_workbooks, pagination_item = server.workbooks.get(req_option)
print([workbook.name for workbook in all_workbooks])
req_option.filter.add(TSC.Filter(TSC.RequestOptions.Field.Name, TSC.RequestOptions.Operator.Equals, tag_to_filter))
for workbook in TSC.Pager(server.workbooks, req_option):
workbook_path = new_folder_path + workbook.name
os.makedirs(workbook_path)
server.workbooks.populate_views(workbook)
for view in workbook.views:
size = TSC.PDFRequestOptions.PageType.Tabloid
orientation = TSC.PDFRequestOptions.Orientation.Landscape
req_option = TSC.PDFRequestOptions(size, orientation)
server.views.populate_pdf(view, req_option)
file_path = workbook_path + '/' + view.name + '.pdf'
print(view.name)
print(file_path)
with open(file_path, 'wb') as image_file:
image_file.write(view.pdf)
print('\tPDF of {0} from {1} workbook'.format(view.name, workbook_path))
提高ServerResponseError.from_response(server_response.content,self.parent_srv.namespace) tableauserverclient.server.endpoint.exceptions.ServerResponseError:
400080:错误的请求 在pdf查询视图'e91a2103-3347-4c91-8d51-a1ef88321492'时出现问题。