# This would help if one IP address is offline. # Make sure threads die properly if a node is offline, possibly be careful not to start new thread if we're awaiting one to finish for ipAddress in ipAddresses: print() print("Processing IP Address: " + ipAddress) try: r = requests.get("http://" + ipAddress, timeout=5) except ConnectionError as e: print("Failed to connect to IP address : " + ipAddress) print(e) continue except ReadTimeout as e: print("Read timeout IP address : " + ipAddress) print(e) continue response = json.loads(r.text) processResponse(response, connection, syncTimestamp) # Create connection connection = DBAccess.create_connection(databasePath) while (True): print() print("Gathering data from sensors and adding to database") gatherTempsAndUpdate(connection) print() print("Sleeping for " + str(querySensorsTime_sec) + " seconds") time.sleep(querySensorsTime_sec)