aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/webhooks.py
diff options
context:
space:
mode:
authorArksine <arksine.code@gmail.com>2020-08-04 17:18:36 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-08-06 14:30:13 -0400
commitcde7e75139b29a89a9f6a5140826464c5223faff (patch)
tree44c726df7f4d8c9f5e722a725b1787340097d1f2 /klippy/webhooks.py
parent447374f73efd0584deec14961b4f041791a2310c (diff)
downloadkutter-cde7e75139b29a89a9f6a5140826464c5223faff.tar.gz
kutter-cde7e75139b29a89a9f6a5140826464c5223faff.tar.xz
kutter-cde7e75139b29a89a9f6a5140826464c5223faff.zip
webhooks: Add call_remote_method helper function
This may be used to execute formatted RPC calls. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Diffstat (limited to 'klippy/webhooks.py')
-rw-r--r--klippy/webhooks.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/klippy/webhooks.py b/klippy/webhooks.py
index f6491187..1525bc42 100644
--- a/klippy/webhooks.py
+++ b/klippy/webhooks.py
@@ -268,5 +268,17 @@ class WebHooks:
raise WebRequestError(msg)
return cb
+ def call_remote_method(self, method, **kwargs):
+ self.sconn.send({'method': method, 'params': kwargs})
+
+ def _action_call_remote_method(self, method, **kwargs):
+ self.call_remote_method(method, **kwargs)
+ return ""
+
+ def get_status(self, eventtime=0.):
+ return {
+ "action_call_remote_method": self._action_call_remote_method
+ }
+
def add_early_printer_objects(printer):
printer.add_object('webhooks', WebHooks(printer))