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,8 +87,8 @@ 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"]: if resp_type in ["chatError", "contactSubSummary"]:
@ -106,7 +106,7 @@ 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
elif RecognizeURLType(url) == 'xftp': elif urltype == 'xftp':
resp,resp_type,failed_response = send_server_checks(url) resp,resp_type,failed_response = send_server_checks(url)
if resp_type in ["chatError", "contactSubSummary"]: if resp_type in ["chatError", "contactSubSummary"]:
@ -124,7 +124,6 @@ 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
else: else:
if index1 == -1 and index2 == -1: if index1 == -1 and index2 == -1:
url = "http://"+url url = "http://"+url
@ -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"