From a216de8b33c880472fd94ab31000960a1bf0fe0c Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Mon, 5 Oct 2026 23:46:01 +1300 Subject: http function --- main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 55c12b9..0fca35e 100644 --- a/main.py +++ b/main.py @@ -1,13 +1,18 @@ from evdev import InputDevice, list_devices, ecodes +from urllib.request import urlopen SCANCODES = {0x11A: "up", 0x148: "down", 0x147: "left", 0x107: "right", 0x106: "ok", 0x141: "play/pause", 0x11c: "power", 0x103: "vol+", 0x142: "vol-"} device = None last = 0x00 +def homelab_request(request: str): + with urlopen(f"http://192.168.1.96/automate/{request}") as resp: + print(f"homelab request {request} response {resp.status}") + def do_action(action: str): if action == "ok": - print("ok") + homelab_request("hack_this_club") # /j for path in list_devices(): candidate = InputDevice(path) -- cgit v1.2.3