use velping as UA

This commit is contained in:
Helix K
2026-03-14 11:41:22 -05:00
parent 3a74afd372
commit e1e4a60b6d
+6 -3
View File
@@ -11,6 +11,9 @@ with open("config.toml", "rb") as f:
app = Flask("velping") app = Flask("velping")
logging.disable(logging.CRITICAL) logging.disable(logging.CRITICAL)
http = requests.Session()
http.headers["User-Agent"] = "velping"
uptime = {} uptime = {}
@@ -25,7 +28,7 @@ def handle_service_status(
and config["ntfy"]["enabled"] and config["ntfy"]["enabled"]
and down and down
): ):
requests.post( http.post(
url=f"https://{config['ntfy']['server']}/{config['ntfy']['topic']}", url=f"https://{config['ntfy']['server']}/{config['ntfy']['topic']}",
data=f"Service {service_name} is offline", data=f"Service {service_name} is offline",
) )
@@ -34,7 +37,7 @@ def handle_service_status(
and config["ntfy"]["enabled"] and config["ntfy"]["enabled"]
and not down and not down
): ):
requests.post( http.post(
url=f"https://{config['ntfy']['server']}/{config['ntfy']['topic']}", url=f"https://{config['ntfy']['server']}/{config['ntfy']['topic']}",
data=f"Service {service_name} is online", data=f"Service {service_name} is online",
) )
@@ -101,7 +104,7 @@ def http_ping(service):
while True: while True:
print(f"[I] Pinging {service['name']}") print(f"[I] Pinging {service['name']}")
try: try:
resp = requests.get( resp = http.get(
url=address, url=address,
timeout=timeout, timeout=timeout,
) )