From e1e4a60b6d58c4b2996f85a167c70b3a874d94a3 Mon Sep 17 00:00:00 2001 From: Helix K Date: Sat, 14 Mar 2026 11:41:22 -0500 Subject: [PATCH] use velping as UA --- index.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.py b/index.py index 35f677f..d97ee65 100644 --- a/index.py +++ b/index.py @@ -11,6 +11,9 @@ with open("config.toml", "rb") as f: app = Flask("velping") logging.disable(logging.CRITICAL) +http = requests.Session() +http.headers["User-Agent"] = "velping" + uptime = {} @@ -25,7 +28,7 @@ def handle_service_status( and config["ntfy"]["enabled"] and down ): - requests.post( + http.post( url=f"https://{config['ntfy']['server']}/{config['ntfy']['topic']}", data=f"Service {service_name} is offline", ) @@ -34,7 +37,7 @@ def handle_service_status( and config["ntfy"]["enabled"] and not down ): - requests.post( + http.post( url=f"https://{config['ntfy']['server']}/{config['ntfy']['topic']}", data=f"Service {service_name} is online", ) @@ -101,7 +104,7 @@ def http_ping(service): while True: print(f"[I] Pinging {service['name']}") try: - resp = requests.get( + resp = http.get( url=address, timeout=timeout, )