Added timeout to http calls, switched get to head

This commit is contained in:
computergeek125 2024-01-31 01:33:39 -06:00
parent 6e776d6383
commit a26159f510
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ class HTTPHandler(BaseHandler):
url = "https://" + url
db_port = self.helper.get_setting("https_port")
try:
resp = requests.get(url + ":" + str(port))
resp = requests.head(url + ":" + str(port), timeout=(0.5, 5))
resp.raise_for_status()
except Exception:
port = db_port
@ -35,7 +35,7 @@ class HTTPHandlerPage(BaseHandler):
url = "https://" + url
db_port = self.helper.get_setting("https_port")
try:
resp = requests.get(url + ":" + str(port))
resp = requests.head(url + ":" + str(port), timeout=(0.5, 5))
resp.raise_for_status()
except Exception:
port = db_port

View File

@ -25,7 +25,7 @@ class HTTPHandlerPage(BaseHandler):
backup_url = url + str(self.helper.get_setting("https_port"))
try:
resp = requests.get(primary_url)
resp = requests.head(primary_url, timeout=(0.5, 5))
resp.raise_for_status()
url = primary_url
except Exception: