def add_connection_and_go(): connection = request.get_json() logging.info('%s - %s' % (connection['css'], connection['nb'])) site = Site() connection_id = site.add_connection_to_current_page(Action.ActionType.CLICK, connection['css'], connection['nb']) action = site.get_action_from_id(connection_id) action.do() return jsonify(gexf=etree.tostring(site.get_gexf()).decode('utf-8'), current_page=site.current)
def follow(connection): config = Configuration() site = Site() if not connection in site._connections: abort(404) if site._connections[connection]['from'] != site.current: abort(500) action = site.get_action_from_id(connection) action.do() return jsonify(gexf=etree.tostring(site.get_gexf()).decode('utf-8'), current_page=site.current)