错误 400 无法使用 Openweathermap API 进行地理编码

Ros*_*tan 5 openweathermap

我正在尝试将 openweathermap 用于我的 python 应用程序,但出现问题。我对此链接做了一个简单的请求:http://api.openweathermap.org/data/2.5/weather?q=London,fr&appid=[My Key]

我收到错误 400 消息Nothing to geocode

你知道这意味着什么吗?

小智 3

它给您带来错误的原因是您向 API 请求法国伦敦 ( q=London,fr) 的数据。该fr部分是国家代码。

您所要做的就是更改fruk,然后就可以设置了!链接为http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=[yourID]