From 3f7b222b92fb48817a168a4272128afcd3b91030 Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Fri, 14 Feb 2014 11:33:53 -0800 Subject: [PATCH 1/3] fix up urls in API example requests --- docs/api/connection.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api/connection.rst b/docs/api/connection.rst index 27feb765..ee2f88f2 100644 --- a/docs/api/connection.rst +++ b/docs/api/connection.rst @@ -20,7 +20,7 @@ Get connection settings .. sourcecode:: http - GET /api/control/connection HTTP/1.1 + GET /api/connection HTTP/1.1 Host: example.com Content-Type: application/json X-Api-Key: abcdef... @@ -77,7 +77,7 @@ Issue a connection command .. sourcecode:: http - POST /api/control/connection HTTP/1.1 + POST /api/connection HTTP/1.1 Host: example.com Content-Type: application/json X-Api-Key: abcdef... @@ -94,7 +94,7 @@ Issue a connection command .. sourcecode:: http - POST /api/control/connection HTTP/1.1 + POST /api/connection HTTP/1.1 Host: example.com Content-Type: application/json X-Api-Key: abcdef... From a630b74fa818bdb0d6dd85ed17d1005d8af1a0a3 Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Fri, 14 Feb 2014 20:55:42 -0800 Subject: [PATCH 2/3] fix crash when getStartTime() returns None --- src/octoprint/util/comm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 4679fc22..6a805d7e 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -672,7 +672,7 @@ class MachineCom(object): "file": self._currentFile.getFilename(), "filename": os.path.basename(self._currentFile.getFilename()), "origin": self._currentFile.getFileLocation(), - "time": time.time() - self._currentFile.getStartTime() + "time": self.getPrintTime() }) elif 'Done saving file' in line: self.refreshSdFiles() @@ -934,7 +934,7 @@ class MachineCom(object): payload = { "local": self._currentFile.getLocalFilename(), "remote": self._currentFile.getRemoteFilename(), - "time": time.time() - self._currentFile.getStartTime() + "time": self.getPrintTime() } self._currentFile = None @@ -947,7 +947,7 @@ class MachineCom(object): "file": self._currentFile.getFilename(), "filename": os.path.basename(self._currentFile.getFilename()), "origin": self._currentFile.getFileLocation(), - "time": time.time() - self._currentFile.getStartTime() + "time": self.getPrintTime() } self._callback.mcPrintjobDone() self._changeState(self.STATE_OPERATIONAL) From b8a59097c270740a9a96a2145998436796e04e5c Mon Sep 17 00:00:00 2001 From: Gabe Rosenhouse Date: Fri, 14 Feb 2014 22:51:27 -0800 Subject: [PATCH 3/3] correct response code for connection success --- docs/api/connection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/connection.rst b/docs/api/connection.rst index 27feb765..19841545 100644 --- a/docs/api/connection.rst +++ b/docs/api/connection.rst @@ -114,6 +114,6 @@ Issue a connection command Defaults to ``false`` if not set. :json boolean autoconnect: ``connect`` command: Whether to attempt to automatically connect to the printer on server startup. If not set no changes will be made to the current setting. - :statuscode 200: No error + :statuscode 204: No error :statuscode 400: If the selected `port` or `baudrate` for a ``connect`` command are not part of the available options. \ No newline at end of file