1.高德天气查询
根据用户输入的adcode,查询目标区域当前/未来的天气情况,数据来源是中国气象局。
文档地址:https://lbs.amap.com/api/webservice/guide/api/weatherinfo
接口地址://restapi.amap.com/v3/weather/weatherInfo?key=您的key&city=110101&extensions=all
查询参数:行政区划编码
1.1.实况天气
天气现象(汉字描述)、实时气温,单位:摄氏度、风向描述、风力级别,单位:级、空气湿度、数据发布的时间
{
"status": "1",
"count": "1",
"info": "OK",
"infocode": "10000",
"lives": [
{
"province": "北京",
"city": "东城区",
"adcode": "110101",
"weather": "阴",
"temperature": "25",
"winddirection": "南",
"windpower": "≤3",
"humidity": "62",
"reporttime": "2023-08-06 08:33:18",
"temperature_float": "25.0",
"humidity_float": "62.0"
}
]
}
1.2.天气预报
{
"status": "1",
"count": "1",
"info": "OK",
"infocode": "10000",
"forecasts": [
{
"city": "东城区",
"adcode": "110101",
"province": "北京",
"reporttime": "2023-08-06 08:33:18",
"casts": [
{
"date": "2023-08-06",
"week": "7",
"dayweather": "多云",
"nightweather": "多云",
"daytemp": "31",
"nighttemp": "24",
"daywind": "北",
"nightwind": "北",
"daypower": "≤3",
"nightpower": "≤3",
"daytemp_float": "31.0",
"nighttemp_float": "24.0"
},
{
"date": "2023-08-07",
"week": "1",
"dayweather": "多云",
"nightweather": "多云",
"daytemp": "30",
"nighttemp": "23",
"daywind": "北",
"nightwind": "北",
"daypower": "≤3",
"nightpower": "≤3",
"daytemp_float": "30.0",
"nighttemp_float": "23.0"
},
{
"date": "2023-08-08",
"week": "2",
"dayweather": "阴",
"nightweather": "阴",
"daytemp": "31",
"nighttemp": "24",
"daywind": "北",
"nightwind": "北",
"daypower": "≤3",
"nightpower": "≤3",
"daytemp_float": "31.0",
"nighttemp_float": "24.0"
},
{
"date": "2023-08-09",
"week": "3",
"dayweather": "雷阵雨",
"nightweather": "多云",
"daytemp": "32",
"nighttemp": "23",
"daywind": "北",
"nightwind": "北",
"daypower": "≤3",
"nightpower": "≤3",
"daytemp_float": "32.0",
"nighttemp_float": "23.0"
}
]
}
]
}
1.3.使用限制
个人开发者认证
调用量上限(次/日):300000
并发量上限(次/秒):200
2.百度天气查询
提供了国内以及海外实时天气信息及未来5天天气预报,支持通过经纬度查询。
文档地址:https://lbsyun.baidu.com/faq/api?title=webapi/weather
接口地址:https://api.map.baidu.com/weather/v1/?district_id=222405&data_type=all&ak=你的ak
查询参数:行政区划编码、经纬度
2.1.国内天气查询
数据:温度(℃)、相对湿度(%)、风力等级、风向描述、天气现象、1小时累计降水量(mm)、云量(%)、能见度(m)、空气质量指数数值、pm2.5等空气成分浓度、数据发布的时间
"status": 0,
"result": {
"location": {
"country": "中国",
"province": "北京市",
"city": "北京市",
"name": "东城",
"id": "110101"
},
"now": {
"text": "晴",
"temp": 27,
"feels_like": 29,
"rh": 73,
"wind_class": "2级",
"wind_dir": "南风",
"prec_1h": 0,
"clouds": 5,
"vis": 29900,
"aqi": 47,
"pm25": 25,
"pm10": 47,
"no2": 14,
"so2": 2,
"o3": 116,
"co": 0.5,
"uptime": "20230807193000"
},
"indexes": [
{
"name": "晨练指数",
"brief": "不宜",
"detail": "有降水,建议在室内做适当锻炼。"
},
{
"name": "洗车指数",
"brief": "不适宜",
"detail": "两天内有雨,雨水和泥水会弄脏爱车。"
},
{
"name": "感冒指数",
"brief": "少发",
"detail": "感冒机率较低,避免长期处于空调屋中。"
},
{
"name": "紫外线指数",
"brief": "强",
"detail": "涂擦 SPF20左右,PA++,避免强光。"
},
{
"name": "穿衣指数",
"brief": "热",
"detail": "适合穿T恤、短薄外套等夏季服装。"
},
{
"name": "运动指数",
"brief": "较不宜",
"detail": "有降水,推荐您在室内进行休闲运动。"
}
],
"alerts": [],
"forecasts": [
{
"text_day": "小雨",
"text_night": "多云",
"high": 28,
"low": 24,
"wc_day": "<3级",
"wd_day": "南风",
"wc_night": "<3级",
"wd_night": "东北风",
"date": "2023-08-07",
"week": "星期一"
},
{
"text_day": "小雨",
"text_night": "多云",
"high": 31,
"low": 24,
"wc_day": "<3级",
"wd_day": "南风",
"wc_night": "<3级",
"wd_night": "南风",
"date": "2023-08-08",
"week": "星期二"
},
...
],
"forecast_hours": [
{
"text": "小雨",
"temp_fc": 27,
"wind_class": "<3级",
"wind_dir": "东风",
"rh": 82,
"prec_1h": 0.2,
"clouds": 75,
"data_time": "2023-08-07 19:00:00"
},
{
"text": "小雨",
"temp_fc": 27,
"wind_class": "3~4级",
"wind_dir": "东北风",
"rh": 90,
"prec_1h": 0.3,
"clouds": 90,
"data_time": "2023-08-07 20:00:00"
},
...
]
},
"message": "success"
}
2.2.使用限制
调用量上限(次/日):个人认证5000,企业认证(3000000)
并发量上限(次/秒):个人认证20,企业认证(100)
3.和风天气
地址:https://dev.qweather.com/docs/features/service-and-data/
查询参数:城市编码、经纬度
3.1.城市天气
数据:温度(℃)、天气状况、风向角度、风向描述、风力等级、风速、相对湿度、当前小时累计降水量、大气压强、能见度、云量
空气质量需要另外调接口:AQI数值、空气质量等级、首要污染物、PM10、PM2.5、臭氧、二氧化氮、二氧化硫、一氧化碳数值
接口地址:https://api.qweather.com/v7/weather/now?location=101010100&key=YOUR_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": [
"QWeather",
"NMC",
"ECMWF"
],
"license": [
"QWeather Developers License"
]
}
}
3.2.使用限制
免费订阅:
调用量上限(次/日):1000
并发量上限(次/秒):100
4.SOJSON天气API
sojson收集了8个天气接口,采用微服务的方式提供出来,响应效率高,可以达到不限制次数,且是免费的。
文档地址:https://www.sojson.com/api/weather.html
4.1.接口请求
接口地址:t.weather.itboy.net/api/weather/city/101030100
查询参数:城市编码、气象编码
实况天气数据:温度、最高温度、最低温度、风、天气、空气质量指数
还有昨天天气、未来十五天天气
{
"message": "success感谢又拍云(upyun.com)提供CDN赞助",
"status": 200,
"date": "20230807",
"time": "2023-08-07 19:55:52",
"cityInfo": {
"city": "天津市",
"citykey": "101030100",
"parent": "天津",
"updateTime": "18:10"
},
"data": {
"shidu": "64%",
"pm25": 14,
"pm10": 29,
"quality": "优",
"wendu": "30",
"ganmao": "各类人群可自由活动",
"forecast": [
{
"date": "07",
"high": "高温 29℃",
"low": "低温 25℃",
"ymd": "2023-08-07",
"week": "星期一",
"sunrise": "05:17",
"sunset": "19:17",
"aqi": 70,
"fx": "南风",
"fl": "2级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
{
"date": "08",
"high": "高温 32℃",
"low": "低温 23℃",
"ymd": "2023-08-08",
"week": "星期二",
"sunrise": "05:18",
"sunset": "19:15",
"aqi": 71,
"fx": "南风",
"fl": "1级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
},
...
],
"yesterday": {
"date": "06",
"high": "高温 31℃",
"low": "低温 24℃",
"ymd": "2023-08-06",
"week": "星期日",
"sunrise": "05:16",
"sunset": "19:18",
"aqi": 42,
"fx": "东风",
"fl": "2级",
"type": "多云",
"notice": "阴晴之间,谨防紫外线侵扰"
}
}
}
4.2.使用限制
缺点:接口每8小时更新一次,不支持jsonp
调用量上限(次/日):不限,过多会进黑名单
并发量上限(次/分钟):300
还没有评论,快来抢第一吧