Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
`type` / `value` / `text`. The existing `notes: list[str]` attribute is
unchanged (it parses the separate legacy `<notes>` element still emitted by
some job types). Fixes #1850.
* Removed the pre-Tableau-8.3 XML namespace fallback
(`http://tableausoftware.com/api`). Every server TSC's `minimum_supported_server_version`
guard has ever admitted uses the current namespace (`http://tableau.com/api`),
and the runtime-detection code has been unreachable in practice for a
decade. `tableauserverclient.namespace` module and `UnknownNamespaceError`
are removed; the public `TSC.DEFAULT_NAMESPACE` re-export still works and
now points at `tableauserverclient.server.server.NAMESPACE`. Fixes #1046.

## 0.18.0 (6 April 2022)
* Switched to using defused_xml for xml attack protection
Expand Down
2 changes: 1 addition & 1 deletion tableauserverclient/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from tableauserverclient.bin._version import get_versions
from tableauserverclient.namespace import NEW_NAMESPACE as DEFAULT_NAMESPACE
from tableauserverclient.server.server import NAMESPACE as DEFAULT_NAMESPACE
Comment thread
jacalata marked this conversation as resolved.
Outdated
from tableauserverclient.models import (
BackgroundJobItem,
CollectionItem,
Expand Down
37 changes: 0 additions & 37 deletions tableauserverclient/namespace.py

This file was deleted.

2 changes: 0 additions & 2 deletions tableauserverclient/server/endpoint/auth_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def sign_in(self, auth_req: "Credentials") -> contextmgr:
**self.parent_srv.http_options,
allow_redirects=False,
)
self.parent_srv._namespace.detect(server_response.content)
self._check_status(server_response, url)
parsed_response = fromstring(server_response.content)
site_id = parsed_response.find(".//t:site", namespaces=self.parent_srv.namespace).get("id", None)
Expand Down Expand Up @@ -154,7 +153,6 @@ def switch_site(self, site_item: "SiteItem") -> contextmgr:
return Auth.contextmgr(self.sign_out)
else:
raise e
self.parent_srv._namespace.detect(server_response.content)
self._check_status(server_response, url)
parsed_response = fromstring(server_response.content)
site_id = parsed_response.find(".//t:site", namespaces=self.parent_srv.namespace).get("id", None)
Expand Down
3 changes: 0 additions & 3 deletions tableauserverclient/server/endpoint/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ def _make_request(
# BE CAREFUL WHEN SHARING THESE RESULTS - MAY CONTAIN YOUR SENSITIVE DATA
# logger.debug(loggable_response)

if content_type == "application/xml":
self.parent_srv._namespace.detect(server_response.content)

return server_response

def _check_status(self, server_response: "Response", url: str | None = None):
Expand Down
9 changes: 6 additions & 3 deletions tableauserverclient/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
EndpointUnavailableError,
)
from tableauserverclient.server.endpoint.exceptions import NotSignedInError
from tableauserverclient.namespace import Namespace

_PRODUCT_TO_REST_VERSION = {
"10.0": "2.3",
Expand All @@ -59,6 +58,11 @@
minimum_supported_server_version = "2.3"
default_server_version = "2.4" # first version that dropped the legacy auth endpoint

# The REST API has used the "http://tableau.com/api" XML namespace since Tableau
# Server 8.3 (2015). Callers on older servers are unsupported.
NAMESPACE = "http://tableau.com/api"
_NAMESPACE_MAP = {"t": NAMESPACE}


class Server:
"""
Expand Down Expand Up @@ -176,7 +180,6 @@ def __init__(self, server_address, use_server_version=False, http_options=None,
self.data_acceleration_report = DataAccelerationReport(self)
self.data_alerts = DataAlerts(self)
self.fileuploads = Fileuploads(self)
self._namespace = Namespace()
self.flow_runs = FlowRuns(self)
self.metrics = Metrics(self)
self.custom_views = CustomViews(self)
Expand Down Expand Up @@ -290,7 +293,7 @@ def baseurl(self):

@property
def namespace(self):
return self._namespace()
return _NAMESPACE_MAP
Comment thread
jacalata marked this conversation as resolved.
Outdated

@property
def auth_token(self):
Expand Down
Loading