Skip to content

Commit f76044d

Browse files
jacalataclaude
andcommitted
fix: remove incorrect version gate on vizWidth/vizHeight for PDF export
The REST API docs claimed vizHeight/vizWidth required API 3.26 and were Cloud-only, but server-side code shows these params have been accepted unconditionally since at least 2021.4 with no platform distinction. Remove the 3.26 guard; the endpoint's own minimum version is sufficient. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ec133ce commit f76044d

4 files changed

Lines changed: 2 additions & 32 deletions

File tree

‎tableauserverclient/server/endpoint/views_endpoint.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def populate_pdf(self, view_item: ViewItem, req_options: "PDFRequestOptions | No
205205
req_options: PDFRequestOptions | None, default None
206206
Optional request options for the request. These options can include
207207
parameters such as orientation, paper size, and viz dimensions
208-
(viz_width and viz_height, which require API version 3.26+).
208+
(viz_width and viz_height).
209209
210210
Returns
211211
-------
@@ -215,11 +215,6 @@ def populate_pdf(self, view_item: ViewItem, req_options: "PDFRequestOptions | No
215215
error = "View item missing ID."
216216
raise MissingRequiredFieldError(error)
217217

218-
if req_options is not None:
219-
if not self.parent_srv.check_at_least_version("3.26"):
220-
if req_options.viz_height or req_options.viz_width:
221-
raise UnsupportedAttributeError("viz_height and viz_width are only supported in API 3.26+")
222-
223218
def pdf_fetcher():
224219
return self._get_view_pdf(view_item, req_options)
225220

‎tableauserverclient/server/endpoint/workbooks_endpoint.py‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,6 @@ def pdf_fetcher() -> bytes:
608608
if not self.parent_srv.check_at_least_version("3.23"):
609609
if req_options.view_filters or req_options.view_parameters:
610610
raise UnsupportedAttributeError("view_filters and view_parameters are only supported in 3.23+")
611-
# vizWidth/vizHeight were added to the PDF endpoint in API 3.26
612-
# (same version as views.populate_pdf; confirmed in REST API reference).
613-
if not self.parent_srv.check_at_least_version("3.26"):
614-
if req_options.viz_height or req_options.viz_width:
615-
raise UnsupportedAttributeError("viz_height and viz_width are only supported in 3.26+")
616611

617612
workbook_item._set_pdf(pdf_fetcher)
618613
logger.info(f"Populated pdf for workbook (ID: {workbook_item.id})")

‎test/test_view.py‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -427,25 +427,7 @@ def test_filter_excel(server: TSC.Server) -> None:
427427
assert response == excel_file
428428

429429

430-
def test_pdf_viz_dimensions_unsupported(server: TSC.Server) -> None:
431-
server.version = "3.8"
432-
response = POPULATE_PDF.read_bytes()
433-
with requests_mock.mock() as m:
434-
m.get(
435-
server.views.baseurl + "/d79634e1-6063-4ec9-95ff-50acbf609ff5/pdf?vizHeight=1080&vizWidth=1920",
436-
content=response,
437-
)
438-
single_view = TSC.ViewItem()
439-
single_view._id = "d79634e1-6063-4ec9-95ff-50acbf609ff5"
440-
441-
req_option = TSC.PDFRequestOptions(viz_height=1080, viz_width=1920)
442-
443-
with pytest.raises(UnsupportedAttributeError):
444-
server.views.populate_pdf(single_view, req_option)
445-
446-
447430
def test_pdf_viz_dimensions(server: TSC.Server) -> None:
448-
server.version = "3.26"
449431
response = POPULATE_PDF.read_bytes()
450432
with requests_mock.mock() as m:
451433
m.get(

‎test/test_workbook.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,7 @@ def test_populate_pdf_unsupported(server: TSC.Server) -> None:
506506

507507

508508
def test_populate_pdf_vf_dims(server: TSC.Server) -> None:
509-
# vizWidth/vizHeight require API 3.26 on both workbooks and views populate_pdf
510-
server.version = "3.26"
511-
server.workbooks.baseurl
509+
server.version = "3.23"
512510
response = POPULATE_PDF.read_bytes()
513511
with requests_mock.mock() as m:
514512
m.get(

0 commit comments

Comments
 (0)