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
获取访问网址出去ip
最新推荐文章于 2022-05-07 20:14:32 发布