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地址查詢API:PConline API

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地址查詢API:Vore API

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
}

IP地址查詢API:IP.sb API

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"
}

IP地址查詢API:IP2Location API

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."
}

2. IP地址歸屬地查詢API:僅查詢本機IP信息

IP地址查詢API:Httpbin API

import requests
response = requests.get("http://httpbin.org/ip")
print(response.json())
{
"origin": "20.249.16.173"
}

3. IP地址歸屬地查詢API:只可通過IP查詢信息

IP地址查詢API:Baidu OpenData API

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"
}
]
}

IP地址查詢API:GeoJS API

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
}

IP地址查詢API:IPinfo API

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"
}
}
}

IP地址查詢API:IPAPI

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."
}

總結

IP地址查詢API是一種高效且實用的網絡工具,它能夠快速解析IP地址背后的信息。通過簡單的接口調用,用戶可以獲取IP地址的地理位置、網絡運營商、所屬地區等關鍵數據。這一API在網絡安全領域可用于識別惡意IP來源,在數據分析中助力精準定位用戶群體,在精準營銷中實現個性化推送。它易于集成,支持多種編程語言,能夠為開發者提供強大的技術支持,提升應用的功能性和用戶體驗。IP地址查詢API憑借其高效性和靈活性,已成為現代網絡應用中不可或缺的工具之一。

上一篇:

GitLab的API調用指南

下一篇:

使用JenkinsRESTAPI的最佳實踐
#你可能也喜歡這些API文章!

我們有何不同?

API服務商零注冊

多API并行試用

數據驅動選型,提升決策效率

查看全部API→
??

熱門場景實測,選對API

#AI文本生成大模型API

對比大模型API的內容創意新穎性、情感共鳴力、商業轉化潛力

25個渠道
一鍵對比試用API 限時免費

#AI深度推理大模型API

對比大模型API的邏輯推理準確性、分析深度、可視化建議合理性

10個渠道
一鍵對比試用API 限時免費