2016-09-28 57 views
0
正确上传.json

到目前为止,我已经产生了下面的代码:检索的wunderground

import requests 

def weatherSearch(): 
    Search = raw_input('Enter your location: ') 
    r = requests.get("http://api.wunderground.com/api/a8c3e5ce8970ae66/conditions/q/{}.json".format(Search)) 
    weatherData = r.json() 
    print weatherData 

weatherSearch() 

例如,如果Search设置为London,它会产生:

http://api.wunderground.com/api/a8c3e5ce8970ae66/conditions/q/London.json

然而,这个.json不包含我试图找到的温度:"temp_c":

W以下链接hereas,"temp_c":可以发现:

http://api.wunderground.com/api/a8c3e5ce8970ae66/conditions/q/CA/San_Francisco.json

我努力理解我,以获取气象数据做错了什么。

回答