This commit is contained in:
2017-09-06 18:25:17 +01:00
commit efb71c4e57
28 changed files with 6865 additions and 0 deletions

16
i3blocks/ipaddress.py Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/python
from urllib.request import urlopen
from xml.etree import ElementTree as ET
url = 'http://freegeoip.net/xml/'
with urlopen(url) as res:
s = res.read()
root = ET.fromstring(s)
ip = root.find('IP').text
country = root.find('CountryName').text
print('/ %s (%s)' % (ip, country))
print('/ %s (%s)' % (ip, country))