API使用

1.注册 OpenWeatherMap 账号
网址:https://openweathermap.org/city/2643743
进行注册登录
2.获取 API Key(API 密钥)
点击右上角用户名 → 选择 “My API Keys”
image
3.调用测试 API 获取天气数据
主要 API 端点
当前天气数据:https://api.openweathermap.org/data/2.5/weather?q={city}&appid={API key}
5天天气预报:https://api.openweathermap.org/data/2.5/forecast?q={city}&appid={API key}
按坐标查询:/weather?lat={lat}&lon={lon}
按城市ID查询:/weather?id={city id}
按邮编查询:/weather?zip={zip code}

posted @ 2025-11-17 09:09  Look_Back  阅读(3)  评论(0)    收藏  举报