天气信息获取

天气信息获取

根据访客位置或IP地址的获取天气信息

55

接口介绍

请求方式:GET
返回格式:JSON
接口地址: https://api.szfx.top/tianqi/
请求示例: https://api.szfx.top/tianqi/?ip=157.255.219.143

请求参数

参数 参数值 必填 说明
ip string 是 需要获取天气信息的IP地址,为空则默认获取访客IP

返回参数

名称类型说明
code string 返回状态码
city string 城市
weather json 返回的天气信息

返回示例

{
  "code": "200",
  "city": "深圳",
  "weather": {
    "date": "2025-06-21",
    "text_day": "多云",
    "code_day": "4",
    "text_night": "多云",
    "code_night": "4",
    "high": "32",
    "low": "27",
    "rainfall": "0.00",
    "precip": "0.00",
    "wind_direction": "无持续风向",
    "wind_direction_degree": "",
    "wind_speed": "8.4",
    "wind_scale": "2",
    "humidity": "86"
  }
}

代码示例

暂无示例

微信公众号 扫码关注公众号
QQ 扫码体验小程序
微信小程序 扫码体验小程序