Files

23 lines
638 B
Python

import time
import network # type: ignore
API_KEY = "3545ce42d0ba436e8dc164532250410"
ACTUAL_WEATHER_URL = "http://api.weatherapi.com/v1/current.json?key={API_KEY}&q={city}&aqi=yes&lang={lang}"
class Wlan:
def __init__(self):
print("Wlan::__init__")
self.wlan = network.WLAN(network.STA_IF)
def connect(self, ssid: str, password: str):
self.wlan.active(True)
self.wlan.connect(ssid, password)
while not self.wlan.isconnected:
print("connecting, please wait ...")
time.sleep(1)
time.sleep(0.25)
print("connected! IP=", self.wlan.ifconfig()[0])