mirror of https://github.com/Desuuuu/klipper.git
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>
This commit is contained in:
parent
447374f73e
commit
cde7e75139
|
@ -268,5 +268,17 @@ class WebHooks:
|
||||||
raise WebRequestError(msg)
|
raise WebRequestError(msg)
|
||||||
return cb
|
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):
|
def add_early_printer_objects(printer):
|
||||||
printer.add_object('webhooks', WebHooks(printer))
|
printer.add_object('webhooks', WebHooks(printer))
|
||||||
|
|
Loading…
Reference in New Issue