import time import machine import network import urequests as requests TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html" wlan = network.WLAN(network.STA_IF) wlan.active(True) wlan.connect("ssid", "passw0rd") while not wlan.isconnected() and wlan.status() >= 0: print(f"Connected? {wlan.isconnected()} Status? {wlan.status()}") time.sleep(1) print(wlan.ifconfig()[0]) # increase delay between requests each time interval_sec = 0 increment_sec = 60 timer_sec = time.time() - interval_sec while True: if time.time() - timer_sec > interval_sec: try: r = requests.get(TEXT_URL) print(f"{interval_sec:>5} {r.status_code} {r.reason.decode()} {r.content}") r.close() interval_sec += increment_sec except OSError as e: print(e) machine.reset() timer_sec = time.time()