From 6c8ef93f9f9c5d3ddf6ee4ee4f0ff453d12c3165 Mon Sep 17 00:00:00 2001 From: Arksine Date: Mon, 9 Nov 2020 07:01:57 -0500 Subject: [PATCH] machine: update request handlers to accept WebRequest objects Signed-off-by: Eric Callahan --- moonraker/plugins/machine.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/moonraker/plugins/machine.py b/moonraker/plugins/machine.py index f35e5ee..b5ae8bd 100644 --- a/moonraker/plugins/machine.py +++ b/moonraker/plugins/machine.py @@ -13,10 +13,11 @@ class Machine: self.server.register_endpoint( "/machine/shutdown", ['POST'], self._handle_machine_request) - async def _handle_machine_request(self, path, method, args): - if path == "/machine/shutdown": + async def _handle_machine_request(self, web_request): + ep = web_request.get_endpoint() + if ep == "/machine/shutdown": cmd = "sudo shutdown now" - elif path == "/machine/reboot": + elif ep == "/machine/reboot": cmd = "sudo shutdown -r now" else: raise self.server.error("Unsupported machine request")