def postFriend(self, data, decrypted): node = Node(public_key = data['public_key']) if 'messages' not in decrypted['data']: decrypted['data']['messages'] = [] if 'friends' not in decrypted['data']: decrypted['data']['friends'] = [] if 'public_key' not in decrypted: decrypted['public_key'] = [] if 'private_key' not in decrypted: decrypted['private_key'] = [] friend = Node(decrypted) node.addFriend(friend.get()) node.save() return {}