35 lines
787 B
Python
35 lines
787 B
Python
import requests
|
|
import threading
|
|
import time
|
|
from datetime import datetime
|
|
|
|
URLS = [
|
|
"http://192.168.1.13/ftthplanner/api/auto_notif_device.php",
|
|
"http://192.168.1.13/ftthplanner/api/auto_notif_onu.php"
|
|
]
|
|
|
|
def hit_url(url):
|
|
try:
|
|
r = requests.get(url, timeout=300)
|
|
print(
|
|
f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] "
|
|
f"{url} -> Status: {r.status_code}"
|
|
)
|
|
except Exception as e:
|
|
print(
|
|
f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] "
|
|
f"{url} -> ERROR: {e}"
|
|
)
|
|
|
|
while True:
|
|
threads = []
|
|
|
|
for url in URLS:
|
|
t = threading.Thread(target=hit_url, args=(url,))
|
|
t.start()
|
|
threads.append(t)
|
|
|
|
for t in threads:
|
|
t.join()
|
|
|
|
time.sleep(30) |