搭建自己的查询IP工具-Python

结果是获取最新的纯净IP,仅包含地区和运营商

#! / target=_blank class=infotextkey>Python

# _*_ coding=UTF-8 _*_

"""

获取最新纯真IP,仅包含地区和运营商

"""

import requests

 

with open('_ip.txt', encoding='UTF-8') as a:

for i in a:

url = f'
https://ipaddr.vercel./api/{i}' # 遍历net_ip.txt文本里的所有公网IP地址

r = requests.get(url).json()

dict_ip = r["detail"]

print('查询IP:', r["search_ip"])

print('地区:', r["addr"])

print('运营商:', r["detail"])

print('n')

 

打印结果:

运行结果

胜象大百科