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:
Arksine 2020-08-04 17:18:36 -04:00 committed by Kevin O'Connor
parent 447374f73e
commit cde7e75139
1 changed files with 12 additions and 0 deletions

View File

@ -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))