Skip to content

Commit 1df059a

Browse files
committed
Add get_resolved_variables method
[ch64060]
1 parent 9cab6f9 commit 1df059a

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

dataikuapi/dssclient.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, host, api_key=None, internal_ticket = None, extra_headers = N
4848
########################################################
4949
# Futures
5050
########################################################
51-
51+
5252
def list_futures(self, as_objects=False, all_users=False):
5353
"""
5454
List the currently-running long tasks (a.k.a futures)
@@ -777,6 +777,24 @@ def get_global_variables(self):
777777
return self._perform_json(
778778
"GET", "/admin/variables/")
779779

780+
def get_resolved_variables(self, project_key=None, typed=False):
781+
"""
782+
Get a dictionary of resolved variables for a project.
783+
784+
:param str project_key: the project key, defaults to the current default project
785+
:param bool typed: if True, the variable values will be typed in the returned dict, defaults to False
786+
:return: a dictionary with instance and project variables merged
787+
788+
:returns: a Python dictionary of the resolved project variables
789+
"""
790+
import dataiku
791+
return self._perform_json(
792+
"GET",
793+
"/projects/%s/variables-resolved" % dataiku.default_project_key() if project_key is None else project_key,
794+
params={
795+
"typed": "true" if typed else "false"
796+
})
797+
780798
def set_variables(self, variables):
781799
"""
782800
Updates the DSS instance's variables
@@ -952,7 +970,7 @@ def get_auth_info_from_browser_headers(self, headers_dict, with_secrets=False):
952970
"""
953971
return self._perform_json("POST", "/auth/info-from-browser-headers",
954972
params={"withSecrets": with_secrets}, body=headers_dict)
955-
973+
956974
def get_ticket_from_browser_headers(self, headers_dict):
957975
"""
958976
Returns a ticket for the DSS user authenticated by the dictionary of

0 commit comments

Comments
 (0)