diff --git a/octorest/websocket.py b/octorest/websocket.py index 5cf3ac6..c6fec59 100644 --- a/octorest/websocket.py +++ b/octorest/websocket.py @@ -52,4 +52,4 @@ def send(self, data): Sends data, currently not working properly. OctoPrint server is unable to parse. """ - self.socket.send(json.dumps(data)) + self.socket.send(json.dumps([json.dumps(data)])) diff --git a/octorest/xhrstreaming.py b/octorest/xhrstreaming.py index 03fcddc..4cf68ee 100644 --- a/octorest/xhrstreaming.py +++ b/octorest/xhrstreaming.py @@ -69,5 +69,5 @@ def send(self, data): print("SENDING") url = self.url.format(protocol="https" if self.secure else "http", method="xhr_send") - response = self.socket.post(url, data=json.dumps(data)) + response = self.socket.post(url, data=json.dumps([json.dumps(data)])) return response diff --git a/octorest/xhrstreaminggenerator.py b/octorest/xhrstreaminggenerator.py index 4e3bd20..fdfdadd 100644 --- a/octorest/xhrstreaminggenerator.py +++ b/octorest/xhrstreaminggenerator.py @@ -64,5 +64,5 @@ def send(self, data): OctoPrint server returns 404 """ url = '/'.join((self.url, 'xhr_send')) - response = self.session.post(url, data=json.dumps(data)) + response = self.session.post(url, data=json.dumps([json.dumps(data)])) return response