import etcd import json client = etcd.Client(port=2379) # this will create a client against etcd server running on localhost on port 4001 some_vm = {} some_vm['network'] = {} some_vm['network']['ipv6'] = [] some_vm['network']['ipv6'].append("2a0a:e5c0:4::42/64") some_vm['network']['ipv6'].append("2a0a:e5c0:1::42/64") #for node in range(200): # client.delete('/nodes/n{}'.format(node)) for node in range(10): ip = some_vm['network']['ipv6'].append("2a0a:e5c0:3::{}/64".format(node)) j = json.dumps(some_vm) client.write('/nodes/n{}'.format(node), j) for node in range(10): x = client.write("/dir/name", "value", append=True) print("generated key: " + x.key) print("stored value: " + x.value) result = client.read('/nodes', recursive=True, sorted=True) print(result) for child in result.children: print("%s: %s" % (child.key,child.value))