Skip to content

Commit 5ccf07e

Browse files
committed
Add Python client to create personal API key
1 parent 40284d8 commit 5ccf07e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

dataikuapi/dssclient.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,19 @@ def get_auth_info_from_browser_headers(self, headers_dict, with_secrets=False):
749749
return self._perform_json("POST", "/auth/info-from-browser-headers",
750750
params={"withSecrets": with_secrets}, body=headers_dict)
751751

752+
def create_personal_api_key(self, label):
753+
"""
754+
Creates a personal API key corresponding to the user doing the request.
755+
This can be called if the DSSClient was initialized with an internal
756+
ticket or with a personal API key
757+
758+
:param: label string: Label for the new API key
759+
:returns: a dict of the new API key, containing at least "secret", i.e. the actual secret API key
760+
:rtype dict
761+
"""
762+
return self._perform_json("POST", "/auth/personal-api-keys",
763+
params={"label": label})
764+
752765
########################################################
753766
# Internal Request handling
754767
########################################################

0 commit comments

Comments
 (0)