11# (C) 2023 GoodData Corporation
22import time
33from pathlib import Path
4- from typing import Callable , Optional , Tuple , Union
4+ from typing import Any , Callable , Dict , Optional , Tuple , Union
55
66from gooddata_api_client .exceptions import NotFoundException
77from gooddata_api_client .model .tabular_export_request import TabularExportRequest
@@ -189,6 +189,7 @@ def export_pdf(
189189 timeout : float = 60.0 ,
190190 retry : float = 0.2 ,
191191 max_retry : float = 5.0 ,
192+ metadata : Optional [Dict [str , Any ]] = None ,
192193 ) -> None :
193194 """
194195 Export a PDF of the specified GoodData Dashboard and save it to the specified file path.
@@ -200,18 +201,25 @@ def export_pdf(
200201 file_name (str):
201202 The name of the PDF file (excluding the file extension).
202203 store_path (Union[str, Path], optional):
203- The path to save the exported PDF. Defaults to the current directory.
204+ The path to save the exported PDF.
205+ Defaults to the current directory.
204206 timeout (float, optional):
205- The maximum amount of time (in seconds) to wait for the server to process the export. Defaults to 60.0.
207+ The maximum amount of time (in seconds) to wait for the server to process the export.
208+ Defaults to 60.0.
206209 retry (float, optional):
207- Initial wait time (in seconds) before retrying to get the exported content. Defaults to 0.2.
210+ Initial wait time (in seconds) before retrying to get the exported content.
211+ Defaults to 0.2.
208212 max_retry (float, optional):
209- The maximum retry wait time (in seconds). Defaults to 5.0.
213+ The maximum retry wait time (in seconds).
214+ Defaults to 5.0.
215+ metadata (Dict[str, Any]):
216+ Specify the metadata for the export.
217+ Specific metadata can override filtering.
210218 """
211219 if not self ._dashboard_id_exists (workspace_id , dashboard_id ):
212220 raise ValueError (f"Dashboard id '{ dashboard_id } ' does not exist for workspace '{ workspace_id } '." )
213221 store_path = store_path if isinstance (store_path , Path ) else Path (store_path )
214- request = VisualExportRequest (dashboard_id = dashboard_id , file_name = file_name )
222+ request = VisualExportRequest (dashboard_id = dashboard_id , file_name = file_name , metadata = metadata )
215223 file_path = store_path / f"{ file_name } .pdf"
216224 create_func = self ._actions_api .create_pdf_export
217225 get_func = self ._actions_api .get_exported_file
0 commit comments