Skip to content

Empty response is not being handled properly. #1657

@CYB3RPHO3NIX

Description

@CYB3RPHO3NIX

Describe the bug
While querying the tableau server using the tableau server client library, I am getting an empty response for which it is throwing an Exception.

Versions
Details of your environment, including:

  • Tableau Server version = 2024.2.13 (20242.25.0710.1539)
  • Python version = 3.13.0
  • TSC library version = 0.38

To Reproduce
This is the tool which I am trying to execute
https://github.com/alexfrancisross/Tableau_Data_Management_Cockpit

Results

Traceback (most recent call last):
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\xml\etree\ElementTree.py", line 1720, in close
    self.parser.Parse(b"", True) # end of data
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^
xml.parsers.expat.ExpatError: no element found: line 1, column 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 166, in _check_status
    raise ServerResponseError.from_response(server_response.content, self.parent_srv.namespace, url)
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\site-packages\tableauserverclient\server\endpoint\exceptions.py", line 30, in from_response
    parsed_response = fromstring(resp)
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\site-packages\defusedxml\common.py", line 127, in fromstring
    return parser.close()
           ~~~~~~~~~~~~^^
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\xml\etree\ElementTree.py", line 1722, in close
    self._raiseerror(v)
    ~~~~~~~~~~~~~~~~^^^
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\xml\etree\ElementTree.py", line 1622, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Scripts\Tableau_Data_Management_Cockpit\main.py", line 133, in <module>
    dict_catalog_data = get_catalog_data(TSC, server)
  File "D:\Scripts\Tableau_Data_Management_Cockpit\gettableaudata.py", line 182, in get_catalog_data
    field_list = get_paged_query_results(tableauserver, 'fieldsConnection', FIELD_QUERY)
  File "D:\Scripts\Tableau_Data_Management_Cockpit\gettableaudata.py", line 422, in get_paged_query_results
    paged_query_results = tableauserver.metadata.paginated_query(query, variables={'first': 1000, 'afterToken': None})
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 274, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\site-packages\tableauserverclient\server\endpoint\metadata_endpoint.py", line 116, in paginated_query
    server_response = self.post_request(url, graphql_query, content_type="application/json")
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 226, in post_request
    return self._make_request(
           ~~~~~~~~~~~~~~~~~~^
        self.parent_srv.session.post,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<4 lines>...
        parameters=parameters,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 141, in _make_request
    self._check_status(server_response, url)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\SampleUser\AppData\Local\Programs\Python\Python313\Lib\site-packages\tableauserverclient\server\endpoint\endpoint.py", line 171, in _check_status
    raise NonXMLResponseError(server_response.content)
tableauserverclient.server.endpoint.exceptions.NonXMLResponseError: b''

NOTE: Be careful not to post user names, passwords, auth tokens or any other private or sensitive information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions