import network from time import sleep wlan = network.WLAN(network.STA_IF) # If the network isn't already connected, try to connect if not wlan.isconnected(): wlan.active(True) # Try to connect to Tufts_Wireless: ssid = "Tufts_Wireless" print("Connecting to {}...".format(ssid)) wlan.connect(ssid) while not wlan.isconnected(): sleep(1) print('.') print("Connected!") print("IP address:", wlan.ifconfig()[0])