def getip(): def visit(url): opener = urllib2.urlopen(url) if url == opener.geturl(): str = opener.read() return re.search('\d+\.\d+\.\d+\.\d+', str).group(0) try: myip = visit("http://pv.sohu.com/cityjson?ie=utf-8") except: try: myip = visit("http://w.1616.net/chaxun/iptolocal.php") except: try: myip = visit("http://www.ip138.com/ip2city.asp") except: myip = "218.107.55.252" return myip
Get the access URL and go out ip
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325773887&siteId=291194637
Recommended
Ranking