feat: Add function to check if site is up

This commit is contained in:
moanos [he/him] 2024-11-05 07:37:52 +01:00
parent e6f12ce5b1
commit 0ccbb18411

View File

@ -34,3 +34,11 @@ def healthcheck_ok():
requests.get(settings.HEALTHCHECKS_URL, timeout=10)
except requests.RequestException as e:
logging.error("Ping to healthcheck-server failed: %s" % e)
def is_404(url):
try:
result = requests.get(url, timeout=10)
return result.status_code == 404
except requests.RequestException as e:
logging.warning(f"Request to {url} failed: {e}")