-
Notifications
You must be signed in to change notification settings - Fork 29
Python wrapper for Jupyter Notebooks Public API #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
601dd25
c5fbe90
d4f2f70
08301dc
a23d027
c9a9a06
54cba76
745fb80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,11 +4,12 @@ class DSSNotebook(object): | |||||
| """ | ||||||
| A Python/R/Scala notebook on the DSS instance | ||||||
| """ | ||||||
| def __init__(self, client, project_key, notebook_name, state=None): | ||||||
| def __init__(self, client, project_key, notebook_name, state=None, content=None): | ||||||
| self.client = client | ||||||
| self.project_key = project_key | ||||||
| self.notebook_name = notebook_name | ||||||
| self.state = state | ||||||
| self.content = content | ||||||
| self.state_is_peek = True | ||||||
|
|
||||||
| def unload(self, session_id=None): | ||||||
|
|
@@ -27,14 +28,19 @@ def unload(self, session_id=None): | |||||
| raise Exception("Several sessions of the notebook are running, choose one") | ||||||
| else: | ||||||
| session_id = state['activeSessions'][0].get('sessionId', None) | ||||||
| return self.client._perform_json("DELETE", "/projects/%s/notebooks/" % self.project_key, params={'notebookName' : self.notebook_name, 'sessionId' : session_id}) | ||||||
| return self.client._perform_json("DELETE", | ||||||
| "/projects/%s/jupyter-notebooks/%s/sessions/%s" % (self.project_key, self.notebook_name, session_id)) | ||||||
|
|
||||||
| def get_state(self): | ||||||
| """ | ||||||
| Get the status of the notebook | ||||||
| """ | ||||||
| if self.state is None: | ||||||
| self.state = self.client._perform_json("GET", "/projects/%s/notebooks/" % self.project_key, params={'notebookName' : self.notebook_name}) | ||||||
| notebook_list = self.client._perform_json("GET", | ||||||
|
||||||
| notebook_list = self.client._perform_json("GET", | |
| notebook_states = self.client._perform_json("GET", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is (and was) not compatible with SQL notebooks