免费IP地址查询API接口推荐
作者:youqing · 2025-09-28 · 阅读时间:9分钟
文章目录
查询API广泛应用于网络安全、数据分析、精准营销等领域,帮助企业和开发者更好地了解用户来源,优化服务配置,提升用户体验。
1、IP地址查询API:查询本机IP或通过IP反查
IP地址查询API:IP.CN API
- URL: https://www.ip.cn/api/index?ip=&type=0
- 请求类型: GET
- 请求参数: ip (可选), type (可选)
- 示例:
import requests
response = requests.get("https://www.ip.cn/api/index?ip=121.8.215.106&type=1")
print(response.json())
- 结果示例:
{
"rs": 1,
"code": 0,
"address": "中国 广东省 广州市 电信",
"ip": "121.8.215.106",
"isDomain": 0
}
- 说明: 对于国外IP的位置信息不太准确。
IP地址查询API:PConline API
- URL: https://whois.pconline.com.cn/ipJson.jsp?ip=&json=true
- 请求类型: GET
- 请求参数: ip (可选), json (可选)
- 示例:
import requests
response = requests.get("https://whois.pconline.com.cn/ipJson.jsp?ip=121.8.215.106&json=true")
print(response.json())
- 结果示例:
{
"ip": "121.8.215.106",
"pro": "广东省",
"proCode": "440000",
"city": "广州市",
"cityCode": "440100",
"region": "",
"regionCode": "0",
"addr": "广东省广州市 电信",
"regionNames": "",
"err": ""
}
- 说明: 对于国外IP的位置信息不太准确。
IP地址查询API:Vore API
- URL: https://api.vore.top/api/IPdata?ip=
- 请求类型: GET
- 请求参数: ip (可选)
- 示例:
import requests
response = requests.get("https://api.vore.top/api/IPdata?ip=121.8.215.106")
print(response.json())
- 结果示例:
{
"code": 200,
"msg": "SUCCESS",
"ipinfo": {
"type": "ipv4",
"text": "121.8.215.106",
"cnip": true
},
"ipdata": {
"info1": "广东省",
"info2": "广州市",
"info3": "增城",
"isp": "电信"
},
"adcode": {
"o": "广东省广州市增城 - 电信",
"p": "广东",
"c": "广州",
"n": "广东-广州",
"r": "广东-广州",
"a": "440100",
"i": true
},
"tips": "接口由VORE-API(https://api.vore.top/)免费提供",
"time": 1708576755
}
- 说明: 支持CORS跨域请求。
IP地址查询API:IP.sb API
- URL: https://api.ip.sb/geoip/
- 请求类型: GET
- 请求参数: ip (可选)
- 示例:
import requests
response = requests.get("https://api.ip.sb/geoip/121.8.215.106")
print(response.json())
- 结果示例:
{
"organization": "China Telecom",
"longitude": 113.2539,
"city": "Guangzhou",
"timezone": "Asia/Shanghai",
"isp": "China Telecom",
"offset": 28800,
"region": "Guangdong",
"asn": 4134,
"asn_organization": "Chinanet",
"country": "China",
"ip": "121.8.215.106",
"latitude": 23.1181,
"continent_code": "AS",
"country_code": "CN",
"region_code": "GD"
}
- 说明: 支持CORS跨域请求。
IP地址查询API:IP2Location API
- URL: https://api.ip2location.io/
- 请求类型: GET
- 请求参数: ip (可选)
- 示例:
import requests
response = requests.get("https://api.ip2location.io/?ip=121.8.215.106")
print(response.json())
- 结果示例:
{
"ip": "121.8.215.106",
"country_code": "CN",
"country_name": "China",
"region_name": "Guangdong",
"city_name": "Guangzhou",
"latitude": 23.127361,
"longitude": 113.26457,
"zip_code": "510140",
"time_zone": "+08:00",
"asn": "4134",
"as": "Asia Pacific Network Information Centre",
"is_proxy": true,
"message": "Limit to 500 queries per day. Sign up for a Free plan at https://www.ip2location.io to get 30K queries per month."
}
- 说明: 每天限制500次查询。
2. IP地址归属地查询API:仅查询本机IP信息
IP地址查询API:Httpbin API
- URL: http://httpbin.org/ip
- 请求类型: GET
- 请求参数: 无
- 示例:
import requests
response = requests.get("http://httpbin.org/ip")
print(response.json())
- 结果示例:
{
"origin": "20.249.16.173"
}
- 说明: 不支持CORS跨域请求。
3. IP地址归属地查询API:只可通过IP查询信息
IP地址查询API:Baidu OpenData API
- URL: http://opendata.baidu.com/api.php?co=&resource_id=6006&oe=utf8&query=
- 请求类型: GET
- 请求参数: query (必填)
- 示例:
import requests
response = requests.get("http://opendata.baidu.com/api.php?co=&resource_id=6006&oe=utf8&query=121.8.215.106")
print(response.json())
- 结果示例:
{
"status": "0",
"t": "",
"set_cache_time": "",
"data": [
{
"ExtendedLocation": "",
"OriginQuery": "121.8.215.106",
"appinfo": "",
"disp_type": 0,
"fetchkey": "121.8.215.106",
"location": "广东省广州市 电信",
"origip": "121.8.215.106",
"origipquery": "121.8.215.106",
"resourceid": "6006",
"role_id": 0,
"shareImage": 1,
"showLikeShare": 1,
"showlamp": "1",
"titlecont": "IP地址查询",
"tplt": "ip"
}
]
}
- 说明: 不支持CORS跨域请求。
IP地址查询API:GeoJS API
- URL: https://get.geojs.io/v1/ip/geo/121.8.215.106.json
- 请求类型: GET
- 请求参数: ip (必填)
- 示例:
import requests
response = requests.get("https://get.geojs.io/v1/ip/geo/121.8.215.106.json")
print(response.json())
- 结果示例:
{
"country": "China",
"timezone": "Asia/Shanghai",
"ip": "121.8.215.106",
"organization": "AS4134 Chinanet",
"asn": 4134,
"area_code": "0",
"organization_name": "Chinanet",
"country_code": "CN",
"country_code3": "CHN",
"continent_code": "AS",
"latitude": "23.1181",
"region": "Guangdong",
"city": "Guangzhou",
"longitude": "113.2539",
"accuracy": 1000
}
- 说明: 支持CORS跨域请求。
IP地址查询API:IPinfo API
- URL: https://ipinfo.io/widget/demo/121.8.215.106
- 请求类型: GET
- 请求参数: ip (必填)
- 示例:
import requests
response = requests.get("https://ipinfo.io/widget/demo/121.8.215.106")
print(response.json())
- 结果示例:
{
"input": "121.8.215.106",
"data": {
"ip": "121.8.215.106",
"city": "Shenzhen",
"region": "Guangdong",
"country": "CN",
"loc": "22.5455,114.0683",
"org": "AS4134 CHINANET-BACKBONE",
"timezone": "Asia/Shanghai",
"asn": {
"asn": "AS4134",
"name": "CHINANET-BACKBONE",
"domain": "chinatelecom.com.cn",
"route": "121.8.0.0/13",
"type": "isp"
},
"company": {
"name": "CHINANET Guangdong province network",
"domain": "chinatelecom.cn",
"type": "isp"
},
"privacy": {
"vpn": false,
"proxy": false,
"tor": false,
"relay": false,
"hosting": false,
"service": ""
},
"abuse": {
"address": "No.31 ,jingrong street,beijing, 100032",
"country": "CN",
"email": "anti-spam@chinatelecom.cn",
"name": "ABUSE CHINANETCN",
"network": "121.8.0.0/13",
"phone": "+000000000"
}
}
}
- 说明: 支持CORS跨域请求。
IP地址查询API:IPAPI
- URL: https://ipapi.com/ip_api.php?ip=121.8.215.106
- 请求类型: GET
- 请求参数: ip (必填)
- 示例:
import requests
response = requests.get("https://ipapi.com/ip_api.php?ip=121.8.215.106")
print(response.json())
- 结果示例:
{
"ip": "121.8.215.106",
"country_code": "CN",
"country_name": "China",
"region_name": "Guangdong",
"city_name": "Guangzhou",
"latitude": 23.127361,
"longitude": 113.26457,
"zip_code": "510140",
"time_zone": "+08:00",
"asn": "4134",
"as": "Asia Pacific Network Information Centre",
"is_proxy": true,
"message": "Limit to 500 queries per day. Sign up for a Free plan at https://www.ip2location.io to get 30K queries per month."
}
- 说明: 每天限制500次查询。
总结
IP地址查询API是一种高效且实用的网络工具,它能够快速解析IP地址背后的信息。通过简单的接口调用,用户可以获取IP地址的地理位置、网络运营商、所属地区等关键数据。这一数据分析中助力精准定位用户群体,在精准营销中实现个性化推送。它易于集成,支持多种编程语言,能够为开发者提供强大的技术支持,提升应用的功能性和用户体验。IP地址查询API凭借其高效性和灵活性,已成为现代网络应用中不可或缺的工具之一。
热门推荐
一个账号试用1000+ API
助力AI无缝链接物理世界 · 无需多次注册
3000+提示词助力AI大模型
和专业工程师共享工作效率翻倍的秘密
热门API
- 1. AI文本生成
- 2. AI图片生成_文生图
- 3. AI图片生成_图生图
- 4. AI图像编辑
- 5. AI视频生成_文生视频
- 6. AI视频生成_图生视频
- 7. AI语音合成_文生语音
- 8. AI文本生成(中国)
最新文章
- 如何获取企查查开放平台 API Key 密钥(分步指南)
- 什么是SDK?避免技术沟通陷阱
- 使用公共API增强内容管理
- 使用 ChatGPT 和 json-server 快速实现 mock API
- 品牌视觉的新时代:Brandfetch Logo API助你轻松获取品牌标识
- Kling AI API 实战指南:通过 Replicate 集成视频生成能力
- FastAPI 快速开发 Web API 项目: 通过 SQLAlchemy 进行数据操作
- 企业位置一键查询:Python 利用天眼查 API 实现经纬度查询
- 如何快速搭建用于模拟测试的Python REST API服务器
- API管理 – 什么是API管理?
- 如何用Python抓取雅虎财经数据
- Ambee土壤API:农业科技中的创新与应用案例