由于原來的天氣api已經(jīng)停止服務(wù),大家可以在天氣API這個網(wǎng)站注冊賬戶后免費調(diào)用(可以免費試用2000次),接口文檔地址:http://tianqiapi.com/index/doc?version=v9
![]() 置頂 |
shuqing2014
講師
展開
由于原來的天氣api已經(jīng)停止服務(wù),大家可以在天氣API這個網(wǎng)站注冊賬戶后免費調(diào)用(可以免費試用2000次),接口文檔地址:http://tianqiapi.com/index/doc?version=v9 |
![]() |
天藍1021
展開
新的weather api地址:http://t.weather.sojson.com/api/weather/city/
后面直接拼接 city_code就可以使用 ![]() torrential
展開
@ 天藍1021 這個按視頻轉(zhuǎn)碼直接拼接不行呀。實際上的網(wǎng)站地址是:http://t.weather.itboy.net/api/weather/city/101250105 ,通過parse.urlencode(city).encode('utf-8') 拼接出來為:http://t.weather.itboy.net/api/weather/city?city=101250105 。然后就404了 |
![]() |
lzh920007745
展開
url='http://t.weather.sojson.com/api/weather/city/101280601'
r=requests.get(url)
response_data=r.json() |
![]() |
初級學(xué)習(xí)自動化
展開
@小女朱阿
date =‘101030100’
url =http://t.weather.sojson.com/api/weather/city/
r =requests.get(url+data) |
![]() |
WX28kmzl35f
展開
@shuqing2014 您好 出現(xiàn) KeyError: 'date'
,"yundong":"非常適宜運動","waichu":"適宜外出","kaichuang":"適宜開窗","jinghuaqi":"關(guān)閉凈化器"}}
Traceback (most recent call last):
File "C:/Users/Lenovo/PycharmProjects/51Test/01_Python基礎(chǔ)/天氣測試/weather_api_test.py", line 12, in <module>
print(response_data["date"])
KeyError: 'date' |
![]() |
tumaowolf
展開
data = {"city_code":"101010100"}
url = "http://t.weather.sojson.com/api/weather/city/101030100" |
承擔(dān)因您的行為而導(dǎo)致的法律責(zé)任,
本站有權(quán)保留或刪除有爭議評論。
參與本評論即表明您已經(jīng)閱讀并接受
上述條款。