400101 Bad Request when trying to download PDF from Tableau Online through Tableau Server Client (Python)

Viewed 62

I'm trying to download a workbook from Tableau Online where I am an admin with download/export permissions. I am able to download the older workbook I am trying to replace. When I change the script I wrote to use the new report by changing the filter parameter, it gives an error: 400101 Bad Request There was a problem querying the pdf for workbook 'xxxx-xxx-xxx-xxx'. I have read that it can take some time for the Tableau servers to update, however, it's been over 24 hours since uploading the report online. Not sure what changed? The workbook I'm trying to download has tabs included, as does the older report, and uses a tde data extract instead of a hyper extract.

Below is the code in question. It fails on the last line:

with server.auth.sign_in(tableau_auth):
    req_option = TSC.RequestOptions(pagesize=1000)
    req_option.filter.add(TSC.Filter(TSC.RequestOptions.Field.Name, 
                                      TSC.RequestOptions.Operator.Equals, 
                                      'Report_Test'))
    all_workbooks_items, pagination_item = server.workbooks.get(req_option)
    pdf_req_option = TSC.PDFRequestOptions(page_type=TSC.PDFRequestOptions.PageType.Legal,
                                          orientation=TSC.PDFRequestOptions.Orientation.Landscape)
    server.workbooks.populate_pdf(all_workbooks_items[0], pdf_req_option)
    with open("./Report.pdf", 'wb') as f:
        f.write(all_workbooks_items[0].pdf)
1 Answers

Internally, we made a mistake and had a filter on the requested workbook that didn't exist in the data source. Changing the data source to include the filter that was missing fixed it!

Related