import threading import requests def auto_request(): url = 'http://localhost:8087/update_water_quality' headers = {'Content-Type': 'application/json'} response = requests.get(url) print(response.text) threading.Timer(15,auto_request).start()