代码: 全选
{
"status": "success",
"country": "法国",
"countryCode": "FR",
"region": "ARA",
"regionName": "奧弗涅-羅訥-阿爾卑斯大區",
"city": "里昂",
"zip": "69000",
"lat": 45.748,
"lon": 4.85,
"timezone": "Europe/Paris",
"isp": "Feelb Sarl",
"org": "HMS",
"as": "AS207992 FEELB SARL",
"query": "45.145.167.184"
}
def get_address(ip):
tap_url = f'https://ip125.com/api/{ip}?lang=zh-CN'
head = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0',
'Cookie': '_ga=GA1.2.348223593.1668760697; _ga_XYJPKQNDKR=GS1.1.1669809730.4.1.1669809752.0.0.0; __gads=ID=e9cb6076c0188403-228d0f367edf00b9:T=1683097828:RT=1701660864:S=ALNI_MZoNQcRpP-66ZZidp6BAlct92mbOw; __gpi=UID=00000c011afd3f29:T=1683097828:RT=1701660864:S=ALNI_MZSTguCSNwyc6d4WgMIcm7m-Xepvg'
}
country_info = requests.get(tap_url, headers=head).json()
return country_info['query']