|
|
|
@ -570,7 +570,7 @@ def downloadHook(count, blockSize, totalSize): |
|
|
|
|
print('%02d%%' % (100.0 * count * blockSize / totalSize)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getLocalIp(): |
|
|
|
|
def getLocalIpBack(): |
|
|
|
|
# 取本地外网IP |
|
|
|
|
try: |
|
|
|
|
import re |
|
|
|
@ -591,6 +591,23 @@ def getLocalIp(): |
|
|
|
|
return '127.0.0.1' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getLocalIp(): |
|
|
|
|
# 取本地外网IP |
|
|
|
|
try: |
|
|
|
|
import re |
|
|
|
|
filename = 'data/iplist.txt' |
|
|
|
|
ipaddress = readFile(filename) |
|
|
|
|
if not ipaddress or ipaddress == '127.0.0.1': |
|
|
|
|
import urllib |
|
|
|
|
url = 'https://v6r.ipip.net/?format=text' |
|
|
|
|
req = urllib.request.urlopen(url, timeout=10) |
|
|
|
|
ipaddress = req.read().decode('utf-8') |
|
|
|
|
writeFile(filename, ipaddress) |
|
|
|
|
return ipaddress |
|
|
|
|
except Exception as ex: |
|
|
|
|
return '127.0.0.1' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def inArray(arrays, searchStr): |
|
|
|
|
# 搜索数据中是否存在 |
|
|
|
|
for key in arrays: |
|
|
|
|