ecoa/Aeon
0
1import logging2import os3import time4 5import requests6 7BASE_URL = os.environ.get("BASE_URL", None)8 9try:10 if not BASE_URL:11 raise TypeError12 BASE_URL = BASE_URL.rstrip("/")13except TypeError:14 BASE_URL = None15 16PORT = os.environ.get("PORT", None)17 18 19def check_status():20 try:21 requests.get(BASE_URL)22 except Exception as e:23 logging.error(f"alive.py: {e}")24 return False25 return True26 27 28if PORT and BASE_URL:29 while True:30 if check_status():31 time.sleep(400)32 else:33 time.sleep(2)34 