|
|
import requests
|
|
|
import time
|
|
|
from datetime import datetime
|
|
|
|
|
|
URL = "https://superbryn-task-backend.onrender.com/health"
|
|
|
INTERVAL = 30
|
|
|
|
|
|
def ping_server():
|
|
|
print(f"๐ Starting pinger for {URL} every {INTERVAL} seconds...")
|
|
|
while True:
|
|
|
try:
|
|
|
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
|
response = requests.get(URL, timeout=10)
|
|
|
|
|
|
if response.status_code == 200:
|
|
|
print(f"[{timestamp}] โ
Success: {response.status_code} - {response.text}")
|
|
|
else:
|
|
|
print(f"[{timestamp}] โ ๏ธ Warning: Status {response.status_code} - {response.text}")
|
|
|
|
|
|
except requests.exceptions.RequestException as e:
|
|
|
print(f"[{timestamp}] โ Error: {e}")
|
|
|
|
|
|
time.sleep(INTERVAL)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
ping_server()
|
|
|
|