Files
weather-info/app/web/wlan.py
2025-11-13 12:46:00 +01:00

21 lines
551 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)
print('connected! IP=', self.wlan.ifconfig()[0])