gpt4 book ai didi

java - 使用 Wea​​ther Underground API 检索天气信息

转载 作者:行者123 更新时间:2023-11-29 05:48:50 25 4
gpt4 key购买 nike

首先,是否可以在 Java 应用程序中使用 API?代码示例没有列出 Java。

无论如何,我想知道是否可以在独立的 Java 应用程序中结合 GeoIP 地理定位和 Weather Underground 来检索天气数据。

要构建的 URL 如下所示:
http://api.wunderground.com/api/[API key here]/conditions/q/CA/San_Francisco.json

  • 那么我可以使用URLConnection 类来获取响应的信息吗?
  • 最佳答案

    1-是的,您应该能够从 Java 应用程序调用它并解析 json 响应

    2- 您可以在查询中指定国家/城市,如下所示:

    http://api.wunderground.com/api/Your_Key/geolookup/conditions/forecast/q/Country/City.json

    关于java - 使用 Wea​​ther Underground API 检索天气信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14804994/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com