|
1 | 1 | import time, warnings, sys, os.path as osp |
2 | 2 | from .dataset import DSSDataset, DSSDatasetListItem, DSSManagedDatasetCreationHelper |
3 | | -from .jupyternotebook import DSSJupyterNotebook |
| 3 | +from .jupyternotebook import DSSJupyterNotebook, DSSJupyterNotebookListItem |
4 | 4 | from .notebook import DSSNotebook |
5 | 5 | from .streaming_endpoint import DSSStreamingEndpoint, DSSStreamingEndpointListItem, DSSManagedStreamingEndpointCreationHelper |
6 | 6 | from .recipe import DSSRecipeListItem, DSSRecipe |
@@ -839,11 +839,11 @@ def list_jupyter_notebooks(self, active=False, as_type="object"): |
839 | 839 | :returns: The list of the notebooks. If "as_type" is "names", each one as a string, if "as_type" is "objects", each one as a :class:`dataikuapi.dss.notebook.DSSJupyterNotebook` |
840 | 840 | :rtype: list of :class:`dataikuapi.dss.notebook.DSSJupyterNotebook` or list of String |
841 | 841 | """ |
842 | | - notebook_names = self.client._perform_json("GET", "/projects/%s/jupyter-notebooks/" % self.project_key, params={"active": active}) |
843 | | - if as_type == "names" or as_type == "name": |
844 | | - return notebook_names |
| 842 | + notebook_items = self.client._perform_json("GET", "/projects/%s/jupyter-notebooks/" % self.project_key, params={"active": active}) |
| 843 | + if as_type == "listitems" or as_type == "listitem": |
| 844 | + return [DSSJupyterNotebookListItem(self.client, notebook_item) for notebook_item in notebook_items] |
845 | 845 | elif as_type == "objects" or as_type == "object": |
846 | | - return [DSSJupyterNotebook(self.client, self.project_key, notebook_name) for notebook_name in notebook_names] |
| 846 | + return [DSSJupyterNotebook(self.client, self.project_key, notebook_item["name"]) for notebook_item in notebook_items] |
847 | 847 | else: |
848 | 848 | raise ValueError("Unknown as_type") |
849 | 849 |
|
|
0 commit comments