From d53bc87065b0cf80dd951a1750f664f937ead3fb Mon Sep 17 00:00:00 2001 From: Tobias Date: Sat, 10 Oct 2026 23:47:10 +0000 Subject: [PATCH] Update scraper.py --- scraper.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/scraper.py b/scraper.py index 002edbb..dd958f9 100644 --- a/scraper.py +++ b/scraper.py @@ -10,22 +10,14 @@ import subprocess ssh_key = "/key/location" ssh_user= "theguy" -#dictionary defining servers, their ip and ssh port +#create dictionary defining servers, their ip and ssh port from json + +try: + with open("/root/servers.json") as f: + servers = json.load(f) +except FileNotFoundError: + raise RuntimeError("servers json file not found") -servers = { - "server1": { - "ip": "1.2.3.4", - "port": 1 - }, - "server2": { - "ip": "5.6.7.8", - "port": 2 - }, - "fakelol": { - "ip": "200.200.200.200", - "port": 22222 - }, -} #load previous state of servers, to avoid constant alert spam try: