Skip to content

Commit

Permalink
Merge pull request #714 from hkad98/timeout
Browse files Browse the repository at this point in the history
fix: allow specifying timeout for get_visualization
  • Loading branch information
pcerny authored Jul 8, 2024
2 parents 70dc039 + 07fc7e9 commit 60c3184
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gooddata-sdk/gooddata_sdk/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import functools
from collections import defaultdict
from enum import Enum
from typing import Any, Optional, Union, cast
from typing import Any, Optional, Tuple, Union, cast

from gooddata_sdk.client import GoodDataApiClient
from gooddata_sdk.compute.model.attribute import Attribute
Expand Down Expand Up @@ -736,14 +736,20 @@ def get_visualizations(self, workspace_id: str) -> list[Visualization]:

return [Visualization(vis_obj, side_loads) for vis_obj in vis_objects.data]

def get_visualization(self, workspace_id: str, visualization_id: str) -> Visualization:
def get_visualization(
self, workspace_id: str, visualization_id: str, timeout: Optional[Union[int, float, Tuple]] = None
) -> Visualization:
"""Gets a single visualization from a workspace.
Args:
workspace_id (str):
Workspace identification string e.g. "demo"
visualization_id (str):
Visualization identifier string e.g. "bikes"
timeout (int | float | tuple):
Timeout in seconds for the request. If a tuple is provided, the first element is the connect timeout
and the second element is the read timeout. If a single value is provided, it is used as both connect
and read timeout. If None, the default timeout is used.
Returns:
Visualization:
Expand All @@ -754,6 +760,7 @@ def get_visualization(self, workspace_id: str, visualization_id: str) -> Visuali
object_id=visualization_id,
include=["ALL"],
_check_return_type=False,
_request_timeout=timeout,
)
side_loads = SideLoads(vis_obj.included)

Expand Down

0 comments on commit 60c3184

Please sign in to comment.