Description
Describe the bug
- The issue is that delete workbook method raises an exception "400029:Bad Request : there was a problem deleting Workbook"
whereas the content is actually getting deleted from the Tableau Server. This occurs when looping around the contents as well as when
a single content is attempted to delete.
Versions
Details of your environment, including:
- Tableau Server version - 2023.1.4
- Python version - 3.12
- TSC library version - 0.28
To Reproduce
Use the server.workbooks.delete method to delete a workbook or multiple workbooks and eventually you will get a generic error "400029:Bad Request : there was a problem deleting Workbook"
import tableauserverclient as TSC
#Username and Password
TOKEN_NAME = 'token'
TOKEN_VALUE = 'token_value'
tableau_auth = TSC.PersonalAccessTokenAuth(TOKEN_NAME, TOKEN_VALUE)
server = TSC.Server('tableauserverURL', use_server_version=True)
server.add_http_options({'verify': False})
server.version = '3.19'
if server.auth.sign_in(tableau_auth):
print("Signed In !!")
else:
print("Unable to Sign In ! Please re-try !! \n\n")
wb = server.workbooks.get_by_id('workbook-id')
print(wb.name)
workbook= server.workbooks.delete('workbook-id')
server.auth.sign_out()
Results
What are the results or error messages received?
Traceback (most recent call last):
File "D:\PythonScripts\auto_Archive_Tableau_Workbooks - Copy.py", line 77, in
server.workbooks.delete(workbook_item.id)
File "C:\Program Files\Python312\Lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 292, in wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\tableauserverclient\server\endpoint\workbooks_endpoint.py", line 133, in delete
self.delete_request(url)
File "C:\Program Files\Python312\Lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 236, in delete_request
self._make_request(self.parent_srv.session.delete, url, auth_token=self.parent_srv.auth_token)
File "C:\Program Files\Python312\Lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 166, in _make_request
self._check_status(server_response, url)
File "C:\Program Files\Python312\Lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 189, in _check_status
raise ServerResponseError.from_response(server_response.content, self.parent_srv.namespace, url)
tableauserverclient.server.endpoint.exceptions.ServerResponseError:
400029: Bad Request
There was a problem deleting workbook 'aecef221-9e27-4002-895d-6e9d962a0dae'.