我正在尝试在我的Python应用程序中使用openweathermap,但出现了问题。我向这个链接发起了一个简单的请求:http://api.openweathermap.org/data/2.5/weather?q=London,fr&appid=[My Key]
我收到了一个400错误,错误信息为Nothing to geocode
。
你知道这是什么意思吗?
我正在尝试在我的Python应用程序中使用openweathermap,但出现了问题。我向这个链接发起了一个简单的请求:http://api.openweathermap.org/data/2.5/weather?q=London,fr&appid=[My Key]
我收到了一个400错误,错误信息为Nothing to geocode
。
你知道这是什么意思吗?
q=London,fr
)。fr
是国家代码。fr
更改为uk
,就可以了!链接将是http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=[yourID]。您需要在URL后面添加lat和lon,然后再添加您的API密钥,这样它才能正常工作:
https://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&APPID=YOUR_API_KEY
您也可以输入位置的纬度和经度,然后再尝试重新构建。
api.openweathermap.org/data/2.5/weather?lat=35&lon=139 就像这样 ^