uptimechecker if statement fix

This commit is contained in:
oxeo0 2025-05-30 16:27:55 +02:00
parent 4f1e6dbbc8
commit 8a01796db9

View file

@ -87,43 +87,42 @@ def main():
index1 = url.find("http://") index1 = url.find("http://")
index2 = url.find("https://") index2 = url.find("https://")
if url.startswith("smp://") or url.startswith("xftp://"): urltype = RecognizeURLType(url)
if RecognizeURLType(url) == 'smp': if urltype == 'smp':
resp,resp_type,failed_response = send_server_checks(url) resp,resp_type,failed_response = send_server_checks(url)
if resp_type in ["chatError", "contactSubSummary"]:
resp, resp_type,failed_response = send_server_checks(url)
if failed_response is None: if resp_type in ["chatError", "contactSubSummary"]:
print(url, "✔️") resp, resp_type,failed_response = send_server_checks(url)
df.at[i, "Status"]="YES"
if df.at[i, "Score"] < 100: if failed_response is None:
df.at[i,"Score"] = df.at[i,"Score"] + 1 print(url, "✔️")
else: df.at[i, "Status"]="YES"
print(url,"") if df.at[i, "Score"] < 100:
df.at[i,"Status"]="NO" df.at[i,"Score"] = df.at[i,"Score"] + 1
#if uptime >0 do -1 to the value else:
if df.at[i,"Score"] > 0: print(url,"")
df.at[i,"Score"] = df.at[i,"Score"] - 1 df.at[i,"Status"]="NO"
#if uptime >0 do -1 to the value
elif RecognizeURLType(url) == 'xftp': if df.at[i,"Score"] > 0:
resp,resp_type,failed_response = send_server_checks(url) df.at[i,"Score"] = df.at[i,"Score"] - 1
if resp_type in ["chatError", "contactSubSummary"]:
resp, resp_type,failed_response = send_server_checks(url)
if failed_response is None:
print(url, "✔️")
df.at[i, "Status"]="YES"
if df.at[i, "Score"] < 100:
df.at[i,"Score"] = df.at[i,"Score"] + 1
else:
print(url,"")
df.at[i,"Status"]="NO"
#if uptime >0 do -1 to the value
if df.at[i,"Score"] > 0:
df.at[i,"Score"] = df.at[i,"Score"] - 1
elif urltype == 'xftp':
resp,resp_type,failed_response = send_server_checks(url)
if resp_type in ["chatError", "contactSubSummary"]:
resp, resp_type,failed_response = send_server_checks(url)
if failed_response is None:
print(url, "✔️")
df.at[i, "Status"]="YES"
if df.at[i, "Score"] < 100:
df.at[i,"Score"] = df.at[i,"Score"] + 1
else:
print(url,"")
df.at[i,"Status"]="NO"
#if uptime >0 do -1 to the value
if df.at[i,"Score"] > 0:
df.at[i,"Score"] = df.at[i,"Score"] - 1
else: else:
if index1 == -1 and index2 == -1: if index1 == -1 and index2 == -1:
@ -144,14 +143,14 @@ def main():
if df.at[i,"Score"] > 0: if df.at[i,"Score"] > 0:
df.at[i,"Score"] = df.at[i,"Score"] - 1 df.at[i,"Score"] = df.at[i,"Score"] - 1
except requests.ConnectionError as e: except requests.ConnectionError:
#print(e) #print(e)
print(url,"") print(url,"")
df.at[i,"Status"]="NO" df.at[i,"Status"]="NO"
#if uptime >0 do -1 to the value #if uptime >0 do -1 to the value
if df.at[i,"Score"] > 0: if df.at[i,"Score"] > 0:
df.at[i,"Score"] = df.at[i,"Score"] - 1 df.at[i,"Score"] = df.at[i,"Score"] - 1
except requests.exceptions.ReadTimeout as e: except requests.exceptions.ReadTimeout:
#print(e) #print(e)
print(url,"") print(url,"")
df.at[i,"Status"]="NO" df.at[i,"Status"]="NO"