Files
@ 4f1c48458236
Branch filter:
Location: freifunk/torian/ffluxbot/update_nodes_list.py - annotation
4f1c48458236
770 B
text/x-python
FF check script update to update nodes list ones a day and to include authentication files for xmpp account
4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 4f1c48458236 | #!/usr/bin/python3
# import json module
import json
import re
# import pprint module
from pprint import pprint
# read json file and create an python dictionary
with open('/home/scripts/ffluxbot/nodes.json') as f:
data = json.load(f)
# print whole json file
# pprint (data)
# print specific value of speciifc item of json fle
#pprint (data["nodes"][0]["nodeinfo"])
# print keys
#x = data.keys()
#pprint (x)
regex = re.compile('fd4e.*')
#y = data.items()
#pprint (y)
#z = data.values()
#pprint (z)
# print hostnames and IPV6 addresses of all nodes
for each in data['nodes']:
hostname = each['nodeinfo']['hostname']
iplist = each['nodeinfo']['network']['addresses']
IP = str(list(filter(regex.match,iplist))[0])
print('{} {}'.format(IP, hostname))
|