From 9f4f3cddc03d2d441c613515621a27bfe8732c21 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 3 Oct 2016 23:43:10 +0200 Subject: update ipaddress MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/plugins/ipaddress.py | 54 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/ipaddress.py b/src/plugins/ipaddress.py index 27b4f92..bb21656 100644 --- a/src/plugins/ipaddress.py +++ b/src/plugins/ipaddress.py @@ -111,15 +111,6 @@ class IPAddress: def __site_0(self, download): - try: - data = spawn_read(*download('http://checkip.dyndns.org')) - if not data == '': - self.__isolated = False - return data.split('')[1].split('')[0].split(': ')[1] - except: - return None - - def __site_1(self, download): try: data = spawn_read(*download('http://ipecho.net/plain')) if not data == '': @@ -129,19 +120,7 @@ class IPAddress: except: return None - def __site_2(self, download): - try: - data = spawn_read(*download('http://www.checkmyipaddress.org')) - if not data == '': - self.__isolated = False - data = [line.strip() for line in data.replace('\r\n', '\n').split('\n') if '' in line] - data = [line.split('>')[1].split('<')[0] for line in data] - data = [line for line in data if ' ' not in line] - return data[0] if not len(data) == 0 else None - except: - return None - - def __site_3(self, download): + def __site_1(self, download): try: data = spawn_read(*download('http://www.ip-address.org')) if not data == '': @@ -160,7 +139,7 @@ class IPAddress: except: return None - def __site_4(self, download): + def __site_2(self, download): try: data = spawn_read(*download('http://www.myipnumber.com/my-ip-address.asp')) if not data == '': @@ -170,7 +149,7 @@ class IPAddress: except: return None - def __site_5(self, download): + def __site_3(self, download): try: data = spawn_read(*download('http://www.findipinfo.com')) if not data == '': @@ -179,7 +158,7 @@ class IPAddress: except: return None - def __site_6(self, download): + def __site_4(self, download): try: data = spawn_read(*download('http://what-ip.net')) if not data == '': @@ -188,7 +167,7 @@ class IPAddress: except: return None - def __site_7(self, download): + def __site_5(self, download): try: data = spawn_read(*download('http://my-ip-address.com')) if not data == '': @@ -197,7 +176,7 @@ class IPAddress: except: return None - def __site_8(self, download): + def __site_6(self, download): try: data = spawn_read(*download('https://duckduckgo.com?q=what is my ip address')) if not data == '': @@ -205,4 +184,25 @@ class IPAddress: return data.split('"Answer":"Your IP address is ')[1].split(' ')[0] except: return None + + def __site_7(self, download): + try: + data = spawn_read(*download('http://checkip.dyndns.org')) + if not data == '': + self.__isolated = False + return data.split('')[1].split('')[0].split(': ')[1] + except: + return None + + def __site_8(self, download): + try: + data = spawn_read(*download('http://www.checkmyipaddress.org')) + if not data == '': + self.__isolated = False + data = [line.strip() for line in data.replace('\r\n', '\n').split('\n') if '' in line] + data = [line.split('>')[1].split('<')[0] for line in data] + data = [line for line in data if ' ' not in line] + return data[0] if not len(data) == 0 else None + except: + return None -- cgit v1.2.3-70-g09d2