最近我的项目中应用到了获取天气相干信息,这里我应用了和风天气接口来实现此性能
和风天气接口API:https://dev.qweather.com/docs...
用户认证KEY:80d5607dd2874a2cbdfd2eeb54ab8e1d一:获取实时天气1:接口地址商业版:https://api.qweather.com/v7/w...开发版:https://devapi.qweather.com/v...2:申请参数key:用户认证keylocation:须要查问地区的经纬度(经度,纬度)3:返回数据
// 北京实况天气 // 商业版 https://api.qweather.com/v7/weather/now?location=101010100&key=你的KEY// 开发版 https://devapi.qweather.com/v7/weather/now?location=101010100&key=你的KEY{ "code": "200", "updateTime": "2020-06-30T22:00+08:00", "fxLink": "http://hfx.link/2ax1", "now": { "obsTime": "2020-06-30T21:40+08:00", "temp": "24", "feelsLike": "26", "icon": "101", "text": "多云", "wind360": "123", "windDir": "东南风", "windScale": "1", "windSpeed": "3", "humidity": "72", "precip": "0.0", "pressure": "1003", "vis": "16", "cloud": "10", "dew": "21" }, "refer": { "sources": [ "Weather China" ], "license": [ "commercial license" ] }}
二:获取将来七天天气1:接口地址商业版:https://api.qweather.com/v7/w...开发版:https://devapi.qweather.com/v...2:申请参数key:用户认证keylocation:须要查问地区的经纬度(经度,纬度)3:返回数据
// 北京3天预报 // 商业版 https://api.qweather.com/v7/weather/3d?location=101010100&key=你的KEY// 开发版 https://devapi.qweather.com/v7/weather/3d?location=101010100&key=你的KEY{ "code": "200", "updateTime": "2021-11-15T16:35+08:00", "fxLink": "http://hfx.link/2ax1", "daily": [ { "fxDate": "2021-11-15", "sunrise": "06:58", "sunset": "16:59", "moonrise": "15:16", "moonset": "03:40", "moonPhase": "盈凸月", "moonPhaseIcon": "803", "tempMax": "12", "tempMin": "-1", "iconDay": "101", "textDay": "多云", "iconNight": "150", "textNight": "晴", "wind360Day": "45", "windDirDay": "东北风", "windScaleDay": "1-2", "windSpeedDay": "3", "wind360Night": "0", "windDirNight": "北风", "windScaleNight": "1-2", "windSpeedNight": "3", "humidity": "65", "precip": "0.0", "pressure": "1020", "vis": "25", "cloud": "4", "uvIndex": "3" }, { "fxDate": "2021-11-16", "sunrise": "07:00", "sunset": "16:58", "moonrise": "15:38", "moonset": "04:40", "moonPhase": "盈凸月", "moonPhaseIcon": "803", "tempMax": "13", "tempMin": "0", "iconDay": "100", "textDay": "晴", "iconNight": "101", "textNight": "多云", "wind360Day": "225", "windDirDay": "西南风", "windScaleDay": "1-2", "windSpeedDay": "3", "wind360Night": "225", "windDirNight": "西南风", "windScaleNight": "1-2", "windSpeedNight": "3", "humidity": "74", "precip": "0.0", "pressure": "1016", "vis": "25", "cloud": "1", "uvIndex": "3" }, { "fxDate": "2021-11-17", "sunrise": "07:01", "sunset": "16:57", "moonrise": "16:01", "moonset": "05:41", "moonPhase": "盈凸月", "moonPhaseIcon": "803", "tempMax": "13", "tempMin": "0", "iconDay": "100", "textDay": "晴", "iconNight": "150", "textNight": "晴", "wind360Day": "225", "windDirDay": "西南风", "windScaleDay": "1-2", "windSpeedDay": "3", "wind360Night": "225", "windDirNight": "西南风", "windScaleNight": "1-2", "windSpeedNight": "3", "humidity": "56", "precip": "0.0", "pressure": "1009", "vis": "25", "cloud": "0", "uvIndex": "3" } ], "refer": { "sources": [ "QWeather", "NMC", "ECMWF" ], "license": [ "commercial license" ] }}三:将来24小时天气1:接口地址商业版:https://api.qweather.com/v7/w...开发版:https://devapi.qweather.com/v...2:申请参数key:用户认证keylocation:须要查问地区的经纬度(经度,纬度)3:返回数据
...