aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-04 17:21:40 +0100
committerGravatar jesopo2018-10-04 17:21:40 +0100
commitf8170d87517e814f7d90556c4e91bda7be98d756 (patch)
tree6d6baa7bc11f9fa11057728ca1b386a4fa77b517 /modules
parentAdd api.servers endpoint (diff)
signature
Use URL path for args, not get params
Diffstat (limited to 'modules')
-rw-r--r--modules/rest_api.py3
-rw-r--r--modules/stats.py4
2 files changed, 4 insertions, 3 deletions
diff --git a/modules/rest_api.py b/modules/rest_api.py
index 0b8ea74c..2f39da78 100644
--- a/modules/rest_api.py
+++ b/modules/rest_api.py
@@ -22,8 +22,9 @@ class Handler(http.server.BaseHTTPRequestHandler):
else:
if parsed.path.startswith("/api/"):
_, _, endpoint = parsed.path[1:].partition("/")
+ endpoint, _, args = endpoint.partition("/")
response = _events.on("api").on(endpoint).call_for_result(
- params=get_params, path=endpoint.split("/"))
+ params=get_params, path=args.split("/"))
if response:
response = json.dumps(response, sort_keys=True,
diff --git a/modules/stats.py b/modules/stats.py
index 05a71ff8..d8266546 100644
--- a/modules/stats.py
+++ b/modules/stats.py
@@ -63,8 +63,8 @@ class Module(ModuleManager.BaseModule):
@utils.hook("api.channels")
def channels_api(self, event):
print(event["path"])
- if "server-id" in event["params"]:
- server_id = event["params"]["server-id"][0]
+ if event["path"]:
+ server_id = event["path"][0]
if not server_id.isdigit():
return None
server_id = int(server_id)