You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
530 B
Python

import urllib.request as request
import json
url = "http://opendata.cwb.gov.tw/api/v1/rest/datastore/F-D0047-069?Authorization=CWB-6B764FB3-BD6E-4198-96C0-43FB4EBA1375&limit=5&offset=0&format=JSON&locationName=%E6%9E%97%E5%8F%A3%E5%8D%80&elementName=T"
# return render_template("weather-form.html")
with request.urlopen(url) as response:
data = json.load(response)
clist = data["records"]
clist2 = clist["locations"][0]
clist3 = clist2["location"]
for i in clist3:
for j in clist3:
print(j["time"])