精确定位IP地址

精确定位IP地址

http://www.chaipip.com/ https://www.ipplus360.com/search/ip/ 这两个网址可以精确定位IP所在街道。可能需要科学上网。 下方是转载来的一个python做的用来精确定位的小程序,没有试过,准备以后有时间仔细看看。

# -- coding:utf-8 -- # author:allen权 import sys import urllib2 import json

def get_ip_information(ip): url=‘http://api.map.baidu.com/highacciploc/v1?qcip=’+ip+’&qterm=pc&ak=‘你的密钥(AK)’&coord=bd09ll&extensions=3’ poiss=’’ request = urllib2.Request(url) page = urllib2.urlopen(request, timeout=10) data_json = page.read() data_dic = json.loads(data_json) if(data_dic.has_key(“content”)): content=data_dic[“content”] address_component=content[“address_component”] formatted_address=content[“formatted_address”] print “该IP地址的具体位置为:” print address_component[“country”] print formatted_address if (content.has_key(“pois”)): print “该IP地址附近POI信息如下:” pois = content[“pois”] for index in range(len(pois)): pois_name = pois[index][“name”] pois_address = pois[index][“address”] print pois_name, pois_address else: print ‘IP地址定位失败!!!’ if name == ‘main’: get_ip_information(‘183.55.116.95’) 程序部分转自:https://www.cnblogs.com/Shepherdzhao/p/7768597.html

相关推荐

机械零件图的制图技巧
365bet取款

机械零件图的制图技巧

📅 06-27 👁️ 3787
再重温一遍,那些年教会我们成长的动画片……
微信为什么不能发语音 手机微信不能发语音解决教程【详解】