1111from tableauserverclient .server .endpoint .endpoint import QuerysetEndpoint , api
1212from tableauserverclient .server .endpoint .exceptions import MissingRequiredFieldError
1313from tableauserverclient .models import CustomViewItem , PaginationItem
14- from tableauserverclient .server import (RequestFactory , RequestOptions , ImageRequestOptions ,
15- PDFRequestOptions , CSVRequestOptions )
14+ from tableauserverclient .server import (
15+ RequestFactory ,
16+ RequestOptions ,
17+ ImageRequestOptions ,
18+ PDFRequestOptions ,
19+ CSVRequestOptions ,
20+ )
1621
1722from tableauserverclient .helpers .logging import logger
1823
@@ -106,16 +111,16 @@ def pdf_fetcher():
106111 custom_view_item ._set_pdf (pdf_fetcher )
107112 logger .info (f"Populated pdf for custom view (ID: { custom_view_item .id } )" )
108113
109- def _get_custom_view_pdf (self , custom_view_item : CustomViewItem ,
110- req_options : Optional ["PDFRequestOptions" ]) -> bytes :
114+ def _get_custom_view_pdf (
115+ self , custom_view_item : CustomViewItem , req_options : Optional ["PDFRequestOptions" ]
116+ ) -> bytes :
111117 url = f"{ self .baseurl } /{ custom_view_item .id } /pdf"
112118 server_response = self .get_request (url , req_options )
113119 pdf = server_response .content
114120 return pdf
115121
116122 @api (version = "3.23" )
117- def populate_csv (self , custom_view_item : CustomViewItem ,
118- req_options : Optional ["CSVRequestOptions" ] = None ) -> None :
123+ def populate_csv (self , custom_view_item : CustomViewItem , req_options : Optional ["CSVRequestOptions" ] = None ) -> None :
119124 if not custom_view_item .id :
120125 error = "Custom View item missing ID."
121126 raise MissingRequiredFieldError (error )
@@ -126,14 +131,14 @@ def csv_fetcher():
126131 custom_view_item ._set_csv (csv_fetcher )
127132 logger .info (f"Populated csv for custom view (ID: { custom_view_item .id } )" )
128133
129- def _get_custom_view_csv (self , custom_view_item : CustomViewItem ,
130- req_options : Optional ["CSVRequestOptions" ]) -> Iterator [bytes ]:
134+ def _get_custom_view_csv (
135+ self , custom_view_item : CustomViewItem , req_options : Optional ["CSVRequestOptions" ]
136+ ) -> Iterator [bytes ]:
131137 url = f"{ self .baseurl } /{ custom_view_item .id } /data"
132138
133139 with closing (self .get_request (url , request_object = req_options , parameters = {"stream" : True })) as server_response :
134140 yield from server_response .iter_content (1024 )
135141
136-
137142 @api (version = "3.18" )
138143 def update (self , view_item : CustomViewItem ) -> Optional [CustomViewItem ]:
139144 if not view_item .id :
0 commit comments