Ejemplo n.º 1
0
def crawler(name):
    crawler = get_crawler(name)
    if crawler is None:
        abort(404)
    stages = crawler_stages(crawler)
    runs = crawler_runs(crawler)
    return render_template('crawler.html',
                           crawler=crawler,
                           stages=stages, runs=runs)
Ejemplo n.º 2
0
def events(name):
    crawler = get_crawler(name)
    if crawler is None:
        abort(404)
    events = crawler_events(crawler,
                            page=int(request.args.get('page', 1)),
                            run_id=request.args.get('run_id'),
                            level=request.args.get('level'),
                            stage_name=request.args.get('stage_name'))
    return render_template('events.html', crawler=crawler, events=events)
Ejemplo n.º 3
0
def invoke(crawler, action):
    crawler = get_crawler(crawler)
    if crawler is None:
        abort(404)
    if action == 'run':
        crawler.run()
    if action == 'cancel':
        crawler.cancel()
    if action == 'flush':
        crawler.flush()
    if action == 'flush-events':
        crawler.flush_events()
    if request.form.get('return') == 'index':
        return redirect(url_for('.index'))
    return redirect(url_for('.crawler', name=crawler.name))
Ejemplo n.º 4
0
def invoke(crawler, action):
    crawler = get_crawler(crawler)
    if crawler is None:
        abort(400)
    if action == 'run':
        crawler.run()
        return jsonify({'status': 'ok'})
    if action == 'cancel':
        crawler.cancel()
        return jsonify({'status': 'ok'})
    if action == 'flush':
        crawler.flush()
        return jsonify({'status': 'ok'})
    if action == 'flush-events':
        crawler.flush_events()
        return jsonify({'status': 'ok'})
    else:
        abort(400)
Ejemplo n.º 5
0
def config(name):
    crawler = get_crawler(name)
    if crawler is None:
        abort(404)
    return render_template('config.html', crawler=crawler)