aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-10-03 23:43:10 +0200
committerMattias Andrée <maandree@kth.se>2016-10-03 23:43:10 +0200
commit9f4f3cddc03d2d441c613515621a27bfe8732c21 (patch)
treef26f17ec45ad151ec9e0c2f4ec7c332c225a7b3e /src/plugins
parentm doc (diff)
downloadxpybar-9f4f3cddc03d2d441c613515621a27bfe8732c21.tar.gz
xpybar-9f4f3cddc03d2d441c613515621a27bfe8732c21.tar.bz2
xpybar-9f4f3cddc03d2d441c613515621a27bfe8732c21.tar.xz
update ipaddress
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/ipaddress.py54
1 files changed, 27 insertions, 27 deletions
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
@@ -112,15 +112,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('<body>')[1].split('</body>')[0].split(': ')[1]
- except:
- return None
-
- def __site_1(self, download):
- try:
data = spawn_read(*download('http://ipecho.net/plain'))
if not data == '':
self.__isolated = False
@@ -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 '</h3>' 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('<body>')[1].split('</body>')[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 '</h3>' 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