Пример #1
0
def run(username, flow):
    # data = lib.get_mixedtables(username, flow)
    # return jsonify(
    #     data=data,
    #     username=username,
    #     flow=flow)

    data = [(u'news:5', 1), (u'norris:6', 2)]
    print(data)
    simpleList = []
    for line in data:
        action_data = lib.run_action(line)
        simpleList.append(action_data)

    return jsonify(data=simpleList,
                   username=username,
                   flow=flow,
                   time=datetime.datetime.now())

    newslist = []
    for line in news:
        list_data = lib.insert_news(line)
        newslist.append[news_data]

    norrislist = []
    for line in norris:
        list_data = lib.insert_data(line)
        norrislist.append[norris_data]
Пример #2
0
def run(username, flow):
    logger.debug('Run invoked')
    data = lib.get_flowdata(username, flow)
    print(data)
    # data = [(u'weather:Brooklyn, NY',), (u'news:3',), (u'norris:3',), (u'news:2',), (u'thecocktail:random',), (u'thecocktail:random',)]
    logger.debug("Data from DB(actionline):" + str(data))
    if not data:  # len(data) == 0:
        return jsonify(
            error="no data for this user and flow",
            username=username,
            flow=flow,
            time=datetime.datetime.now()
        )

    simple_list = []
    for idx, line in enumerate(data):
        actionline = line[0]
        logger.debug("Actionline: " + str(actionline))
        action_data = lib.run_action(actionline)
        simple_list.append({
            "action": idx,
            "type": actionline.split(":")[0],
            "data": action_data
        })

    logger.debug("Action data" + str(action_data))
    return jsonify(
        username=username,
        flow=flow,
        time=datetime.datetime.now(),
        data=simple_list
    )
Пример #3
0
def run_user(username):
    logger.debug('Run invoked')
    flow = "goodmorning"
    data = lib.get_flowdata(username, flow)
    print(data)
    logger.debug("Data from DB(actionline):" + str(data))
    if not data:
        return jsonify(
            error="no data for this user and flow",
            username=username,
            flow=flow,
            time=datetime.datetime.now()
        )

    simple_list = []
    for idx, line in enumerate(data):
        actionline = line[0]
        logger.debug("Actionline: " + str(actionline))
        action_data = lib.run_action(actionline)
        simple_list.append({
            "action": idx,
            "type": actionline.split(":")[0],
            "data": action_data
        })

    logger.debug("Action data" + str(action_data))
    return jsonify(
        username=username,
        flow=flow,
        time=datetime.datetime.now(),
        data=simple_list
    )
Пример #4
0
def run(username, flow):
    data = lib.get_flowdata(username, flow)
    # data = [(u'news:3', 1), (u'norris:3', 2)]
    # print(data)
    if not data:  # len(data) == 0:
        return jsonify(error="no data for this user and flow",
                       username=username,
                       flow=flow,
                       time=datetime.datetime.now())

    simple_list = []
    for idx, line in enumerate(data):
        actionline = line[0]
        action_data = lib.run_action(actionline)
        simple_list.append({
            "action": idx,
            "type": actionline.split(":")[0],
            "data": action_data
        })

    # simpleList = []
    # for line in data:
    #     actionline = line[0]
    #     action_data = lib.run_action(actionline)
    #     simple_list.append(action_data)

    return jsonify(username=username,
                   flow=flow,
                   time=datetime.datetime.now(),
                   data=simple_list)
Пример #5
0
def run(username, flow):
    logger.debug('run invoked')
    data = lib.get_flowdata(username, flow)

    simple_list = []
    for idx, line in enumerate(data):
        actionline = line
        action_data = lib.run_action(actionline)

        simple_list.append({
            "action": idx,
            "type": actionline.split(":")[0],
            "data": action_data
        })
    logger.debug("Action_data: " + str(action_data))
    return jsonify(username=username,
                   flow=flow,
                   time=datetime.datetime.now(),
                   data=simple_list)
Пример #6
0
def run(username, flow):
    # data = lib.get_mixedtables(username, flow)
    # return jsonify(
    #     data=data,
    #     username=username,
    #     flow=flow)

    data = [(u'news:5', 1), (u'norris:6', 2)]
    print(data)
    simpleList = []
    for line in data:
        action_data = lib.run_action(line)
        simpleList.append(action_data)
    count = 4
    news = lib.get_news(count)
    norris = lib.get_norris(count)

    return jsonify(data=simpleList,
                   username=username,
                   flow=flow,
                   time=datetime.datetime.now())
Пример #7
0
def run(username, flow):
    logger.debug('run invoked')
    data = lib.get_flowdata(username, flow)
    # print(data)
    # data = [u'news:3', u'norris:3', u'coctail:random', u'weather:Brooklyn, NY']
    # data = [(u'weather:Brooklyn, NY',), (u'news:3',), (u'norris:3',), (u'news:2',), (u'thecocktail:random',), (u'thecocktail:random',)]
    # logger.debug("data from DB:" + str(data))
    # if not data:  # len(data) == 0:
    #     return jsonify(
    #         error="no data for this user and flow",
    #         username=username,
    #         flow=flow,
    #         time=datetime.datetime.now()
    #     )

    simple_list = []
    for idx, line in enumerate(data):
        actionline = line
        # print(actionline)
        action_data = lib.run_action(actionline)
        # print(action_data)
        simple_list.append({
            "action": idx,
            "type": actionline.split(":")[0],
            "data": action_data
        })

    # simpleList = []
    # for line in data:
    #     actionline = line[0]
    #     action_data = lib.run_action(actionline)
    #     simple_list.append(action_data)
    # weather_data =lib.run_weather(action)
    logger.debug("action data" + str(action_data))
    return jsonify(username=username,
                   flow=flow,
                   time=datetime.datetime.now(),
                   data=simple_list)