# weather_assistant **Repository Path**: hduzn/weather_assistant ## Basic Information - **Project Name**: weather_assistant - **Description**: 旅行出门,天气查询助手。 - **Primary Language**: HTML - **License**: MIT - **Default Branch**: master - **Homepage**: http://106.52.92.136:9081/cn/wea_assistant2.html - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-19 - **Last Updated**: 2025-01-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 旅行出门天气查询助手 #### 介绍 旅行出门前,可以添加n个城市,然后一键查询这些城市的天气和最高气温等天气情况。 并且生成一张最高气温和最低气温的折线图,方便对比这些城市的气温情况。 用来旅行出门前查询想关注的这些城市的天气和气温情况。 #### 使用说明 用的是免费的和风天气免费版的API接口。每日1000次限额。 接口使用说明在这里:https://dev.qweather.com/docs/api/weather/weather-daily-forecast 注册下,创建应用后,再创建凭据(API key)就可以自用了。 运行 index.html 页面,在上面填写API key后就可以添加城市查询了。 #### 代码实现 1.获取输入城市对应的ID 通过和风天气的GeoAPI,查询城市对应的ID。 https://dev.qweather.com/docs/api/geoapi/city-lookup/ 对应的请求Get链接是这样的:https://geoapi.qweather.com/v2/city/lookup?key=[apiKey]&location=[城市名称] 2.根据城市ID再查询天气预报 免费版本支持3天或7天的预报。 https://dev.qweather.com/docs/api/weather/weather-daily-forecast/ 对应的Get请求链接是这样的:https://devapi.qweather.com/v7/weather/7d?key=[apiKey]&location=[城市ID] ![输入图片说明](weather_assistant2.png)