import network import webrepl webrepl.start() sta_if = network.WLAN(network.STA_IF) sta_if.active(True) if sta_if.status() != network.STAT_GOT_IP: availableNetworkSSIDs = [s[0].decode() for s in sta_if.scan()] print(availableNetworkSSIDs) #load wifi credentials from file with open("wifi-credentials","r") as f: while sta_if.status() != network.STAT_GOT_IP: ssid = f.readline() password = f.readline()# if not ssid or not password: break ssid = ssid.replace("\n","") password = password.replace("\n","") if ssid in availableNetworkSSIDs: print("Connecting to",ssid) sta_if.connect(ssid,password) break