全球IP地址查询API通过解析IP地址,提供包括国家、省、市、区县和运营商在内的详细信息。
使用示例
请求参数说明:
| 名称 | 必填 | 类型 | 说明 |
|---|---|---|---|
| key | 是 | string | 个人中心查看 |
| ip | 是 | string | ip地址 |
返回参数说明:
| 名称 | 类型 | 说明 |
|---|---|---|
| ip | string | ip地址 |
| country | string | 国家/地区 |
| province | string | 省份 |
| city | string | 城市 |
| isp | string | 运营商 |
| district | string | 区县 |
| area | string | 地址区域 |
JSON返回示例:
{
"code": 1,
"msg": "操作成功",
"data": {
"ip": "115.192.236.48",
"country": "中国",
"province": "浙江",
"city": "杭州",
"district": "余杭区",
"area": "浙江杭州余杭区",
"isp": "电信"
}
}
Python代码示例
接口地址:https://www.tanshuapi.com/market/detail-82
import requests
# 设置API Key
key = 'your_api_key' # 你的API密钥
ip = '112.112.11.11' # 要查询的IP地址
# 构造请求的URL
url = f"https://api.tanshuapi.com/api/attribution_ip/v1/index?key={key}&ip={ip}"
# 发送请求
response = requests.get(url)
# 解析返回结果
result = response.json()
# 输出查询结果
print(result)
总结
全球IP地址查询API以其高准确性、实时性和良好的性价比,成为企业在互联网时代不可或缺的工具。无论是在跨境电商、广告投放还是网络安全领域,它都能为企业提供强大的支持,助力业务的高效发展和精准决策。选择全球IP地址查询API,让您的业务更加智能、高效。