Skip to content

Commit 3b668cd

Browse files
Copilotjacalatabcantoni
authored
Remove deprecated cgi module and clean up related dead code (#1771)
* Remove deprecated cgi module usage and clean up dead code Agent-Logs-Url: https://github.com/tableau/server-client-python/sessions/453f920c-7857-4503-ad99-0ccef076d792 Co-authored-by: jacalata <2009720+jacalata@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jacalata <2009720+jacalata@users.noreply.github.com> Co-authored-by: Brian Cantoni <bcantoni@salesforce.com>
1 parent 6acd12f commit 3b668cd

4 files changed

Lines changed: 6 additions & 30 deletions

File tree

‎tableauserverclient/helpers/headers.py‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎tableauserverclient/server/endpoint/datasources_endpoint.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from typing import Literal, Optional, TYPE_CHECKING, TypedDict, TypeVar, Union, overload
1010
from collections.abc import Iterable, Sequence
1111

12-
from tableauserverclient.helpers.headers import fix_filename
1312
from tableauserverclient.models.dqw_item import DQWItem
1413
from tableauserverclient.server.query import QuerySet
1514

@@ -1029,14 +1028,13 @@ def download_revision(
10291028
with closing(self.get_request(url, parameters={"stream": True})) as server_response:
10301029
m = Message()
10311030
m["Content-Disposition"] = server_response.headers["Content-Disposition"]
1032-
params = m.get_filename(failobj="")
1031+
filename = m.get_filename(failobj="")
10331032
if isinstance(filepath, io_types_w):
10341033
for chunk in server_response.iter_content(1024): # 1KB
10351034
filepath.write(chunk)
10361035
return_path = filepath
10371036
else:
1038-
params = fix_filename(params)
1039-
filename = to_filename(os.path.basename(params))
1037+
filename = to_filename(os.path.basename(filename))
10401038
download_path = make_download_path(filepath, filename)
10411039
with open(download_path, "wb") as f:
10421040
for chunk in server_response.iter_content(1024): # 1KB

‎tableauserverclient/server/endpoint/flows_endpoint.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from typing import Optional, TYPE_CHECKING, Union
99
from collections.abc import Iterable
1010

11-
from tableauserverclient.helpers.headers import fix_filename
12-
1311
from tableauserverclient.server.endpoint.dqw_endpoint import _DataQualityWarningEndpoint
1412
from tableauserverclient.server.endpoint.endpoint import QuerysetEndpoint, api
1513
from tableauserverclient.server.endpoint.exceptions import InternalServerError, MissingRequiredFieldError
@@ -227,14 +225,13 @@ def download(self, flow_id: str, filepath: Optional[PathOrFileW] = None) -> Path
227225
with closing(self.get_request(url, parameters={"stream": True})) as server_response:
228226
m = Message()
229227
m["Content-Disposition"] = server_response.headers["Content-Disposition"]
230-
params = m.get_filename(failobj="")
228+
filename = m.get_filename(failobj="")
231229
if isinstance(filepath, io_types_w):
232230
for chunk in server_response.iter_content(1024): # 1KB
233231
filepath.write(chunk)
234232
return_path = filepath
235233
else:
236-
params = fix_filename(params)
237-
filename = to_filename(os.path.basename(params))
234+
filename = to_filename(os.path.basename(filename))
238235
download_path = make_download_path(filepath, filename)
239236
with open(download_path, "wb") as f:
240237
for chunk in server_response.iter_content(1024): # 1KB

‎tableauserverclient/server/endpoint/workbooks_endpoint.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from contextlib import closing
77
from pathlib import Path
88

9-
from tableauserverclient.helpers.headers import fix_filename
109
from tableauserverclient.models.permissions_item import PermissionsRule
1110
from tableauserverclient.server.query import QuerySet
1211

@@ -1102,14 +1101,13 @@ def download_revision(
11021101
with closing(self.get_request(url, parameters={"stream": True})) as server_response:
11031102
m = Message()
11041103
m["Content-Disposition"] = server_response.headers["Content-Disposition"]
1105-
params = m.get_filename(failobj="")
1104+
filename = m.get_filename(failobj="")
11061105
if isinstance(filepath, io_types_w):
11071106
for chunk in server_response.iter_content(1024): # 1KB
11081107
filepath.write(chunk)
11091108
return_path = filepath
11101109
else:
1111-
params = fix_filename(params)
1112-
filename = to_filename(os.path.basename(params))
1110+
filename = to_filename(os.path.basename(filename))
11131111
download_path = make_download_path(filepath, filename)
11141112
with open(download_path, "wb") as f:
11151113
for chunk in server_response.iter_content(1024): # 1KB

0 commit comments

Comments
 (0)