keepalive/SendingMechanism/keepalive-daemon.py

21 lines
392 B
Python

# keepalive_daemon.py
import time
import requests
IP = "0.0.0.0"
NAME = "TEST-daemon"
INTERVAL = 10 # seconds
def main():
while True:
try:
url = f"http://{IP}/{NAME}/"
print(f"POST to {url}")
requests.post(url)
except Exception as e:
print("Error:", e)
time.sleep(INTERVAL)
if __name__ == "__main__":
main()