Esempio n. 1
0
import click
import sqlalchemy_searchable
import yaml

from cal import db, User
from scrapers import scrapers

@click.group()
def cli():
    pass


@cli.command()
@click.option("--scraper", default="all",
              type=click.Choice(["all"] + list(scrapers.keys())))
@click.pass_context
def create(ctx, scraper):
    """Create database and run scrapers"""
    db.configure_mappers()  # needed for SQLAlchemy-Searchable
    db.create_all()

    update.invoke(ctx)


@cli.command()
@click.option("--scraper", default="all",
              type=click.Choice(["all"] + list(scrapers.keys())))
def update(scraper):
    """Run scrapers to fill database"""
    # Populate the user database
Esempio n. 2
0
def index():
    return render_template('index.html', engines_list=scrapers.keys())