【问题标题】:Error 400 Nothing to geocode with Openweathermap API错误 400 无需使用 Openweathermap API 进行地理编码
【发布时间】:2018-04-03 06:46:10
【问题描述】:

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

我收到一条错误 400,消息为 Nothing to geocode

你知道这是什么意思吗?

【问题讨论】:

    标签: openweathermap


    【解决方案1】:

    它给你一个错误的原因是你正在向 API 请求法国伦敦的数据 (q=London,fr)。 fr 部分是国家代码。

    您只需将fr 更改为uk 即可!链接为http://api.openweathermap.org/data/2.5/weather?q=London,uk&appid=[yourID]

    【讨论】:

      【解决方案2】:

      您也可以输入位置的经纬度,然后尝试重新构建。

      api.openweathermap.org/data/2.5/weather?lat=35&lon=139 喜欢这个^

      【讨论】:

        【解决方案3】:

        您必须在 URL 后添加 latlon,然后添加您的 API 密钥,然后它就会起作用:

        https://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&APPID=YOUR_API_KEY

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多