### PM2.5 Open Data https://opendata.epa.gov.tw/Data/Contents/AQI ### 連線 wifi from machine import Pin import time, network, urequests # 連線 Wifi 網路 sta_if = network.WLAN(network.STA_IF) sta_if.active(True) sta_if.connect("Wifi基地台", "Wifi密碼") while not sta_if.isconnected(): pass print("Wifi已連上") ### get() 旗標網站 >>> res = urequests.get("https://flagtech.github.io/flag.txt") >>> print(res.text) ### get() PM2.5 Open Data >>> res = urequests.get("http://opendata.epa.gov.tw/webapi/Data/REWIQA/?$filter=SiteName%20eq%20%27%E5%A4%A7%E9%87%8C%27&$orderby=SiteName&$skip=0&$top=1000&format=json") >>> print(res.text) >>> j = res.json() >>> print(j[0]["SiteName"]) >>> print(j[0]["AQI"])