aboutsummaryrefslogtreecommitdiff
path: root/modules/rest_api.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-11-27 14:25:12 +0000
committerGravatar jesopo2018-11-27 14:25:12 +0000
commitd13a5069e3a0e78a77bf16effe78f2ba223c495b (patch)
treeea7fb7c8dfcb0cea94523572e03b7bab35d7aa49 /modules/rest_api.py
parentShow list of users in a channel, not just count (diff)
signature
Grab response from functions asked to be executed on the main thread and feed
them back to the callers, allowing rest_api.py to take the main thread while it's waiting for the response to give back to the requesting client
Diffstat (limited to 'modules/rest_api.py')
-rw-r--r--modules/rest_api.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/rest_api.py b/modules/rest_api.py
index 28d05aed..601eebd8 100644
--- a/modules/rest_api.py
+++ b/modules/rest_api.py
@@ -30,9 +30,10 @@ class Handler(http.server.BaseHTTPRequestHandler):
if path.startswith("/api/"):
event_response = None
try:
- event_response = _events.on("api").on(method).on(
+ event_response = _bot.trigger(lambda:
+ _events.on("api").on(method).on(
endpoint).call_unsafe_for_result(params=params,
- path=args, data=data, headers=dict(self.headers))
+ path=args, data=data, headers=dict(self.headers)))
except Exception as e:
_log.error("failed to call API endpoint \"%s\"",
[path], exc_info=True)