Skip to content

Commit

Permalink
fix: allow specifying timeout for get_visualization
Browse files Browse the repository at this point in the history
It was reported by customer that they would appreciate to have the timeout setting for get_visualization method. We agreed that it would be the best to have this setting for every exposed method. In this first iteration, it is only exposed for this specific method. Note, that we want to add it for other methods in the future, and also add global setting.

JIRA: EB-119
  • Loading branch information
hkad98 committed Jul 8, 2024
1 parent 70dc039 commit 07fc7e9
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 07fc7e9

Please sign in to comment.