Exemplo n.º 1
0
def fetch_asyncio(user_id, feed_id):
    "Crawl the feeds with asyncio."
    import asyncio

    with application.app_context():
        populate_g()
        from flask import g
        from web.models import User
        from crawler import classic_crawler
        users = []
        try:
            users = User.query.filter(User.id == int(user_id)).all()
        except:
            users = User.query.all()
        finally:
            if users == []:
                users = User.query.all()

        try:
            feed_id = int(feed_id)
        except:
            feed_id = None

        loop = asyncio.get_event_loop()
        for user in users:
            if user.activation_key == "":
                print("Fetching articles for " + user.nickname)
                g.user = user
                classic_crawler.retrieve_feed(loop, g.user, feed_id)
        loop.close()
Exemplo n.º 2
0
def fetch_asyncio(user_id, feed_id):
    "Crawl the feeds with asyncio."
    import asyncio

    with application.app_context():
        populate_g()
        from flask import g
        from web.models import User
        from crawler import classic_crawler
        users = []
        try:
            users = User.query.filter(User.id == int(user_id)).all()
        except:
            users = User.query.all()
        finally:
            if users == []:
                users = User.query.all()

        try:
            feed_id = int(feed_id)
        except:
            feed_id = None

        loop = asyncio.get_event_loop()
        for user in users:
            if user.activation_key == "":
                print("Fetching articles for " + user.nickname)
                g.user = user
                classic_crawler.retrieve_feed(loop, g.user, feed_id)
        loop.close()
Exemplo n.º 3
0
#
#
#
# ***** END LICENSE BLOCK *****

__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.1 $"
__date__ = "$Date: 2016/03/30 $"
__revision__ = "$Date: 2016/08/07 $"
__copyright__ = "Copyright (c) "
__license__ = ""

from bootstrap import conf, app, populate_g

with app.app_context():
    populate_g()

    # HTML views
    from web import views
    app.register_blueprint(views.user_bp)
    app.register_blueprint(views.shelter_bp)
    app.register_blueprint(views.shelters_bp)
    app.register_blueprint(views.admin_bp)

    # API v0.1
    app.register_blueprint(views.api.blueprint_user)
    app.register_blueprint(views.api.blueprint_shelter)
    app.register_blueprint(views.api.blueprint_shelter_picture)
    app.register_blueprint(views.api.blueprint_section)
    app.register_blueprint(views.api.blueprint_category)
    app.register_blueprint(views.api.blueprint_attribute)
Exemplo n.º 4
0
def db_init():
    "Will initialize the database."
    print("Initialization of the database...")
    with app.app_context():
        populate_g()
        web.models.db_init(db)
Exemplo n.º 5
0
def db_empty():
    "Will drop the database."
    print("Dropping database...")
    with app.app_context():
        populate_g()
        web.models.db_empty(db)
Exemplo n.º 6
0
#
#
# ***** END LICENSE BLOCK *****

__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.1 $"
__date__ = "$Date: 2016/03/30 $"
__revision__ = "$Date: 2016/08/07 $"
__copyright__ = "Copyright (c) "
__license__ = ""

from bootstrap import conf, app, populate_g
import os

with app.app_context():
    populate_g()

    # HTML views
    from web import views
    app.register_blueprint(views.user_bp)
    app.register_blueprint(views.shelter_bp)
    app.register_blueprint(views.shelters_bp)
    app.register_blueprint(views.admin_bp)

    # API v0.1
    app.register_blueprint(views.api.blueprint_user)
    app.register_blueprint(views.api.blueprint_shelter)
    app.register_blueprint(views.api.blueprint_shelter_picture)
    app.register_blueprint(views.api.blueprint_section)
    app.register_blueprint(views.api.blueprint_category)
    app.register_blueprint(views.api.blueprint_attribute)
Exemplo n.º 7
0
def db_create():
    "Will create the database."
    print("Creation of the database...")
    with app.app_context():
        populate_g()
        web.models.db_create(db)
Exemplo n.º 8
0
def db_init():
    "Will initialize the database."
    print("Initialization of the database...")
    with app.app_context():
        populate_g()
        web.models.db_init(db)
Exemplo n.º 9
0
def db_empty():
    "Will drop the database."
    print("Dropping database...")
    with app.app_context():
        populate_g()
        web.models.db_empty(db)
Exemplo n.º 10
0
def db_create():
    "Will create the database from conf parameters."
    with application.app_context():
        populate_g()
        web.models.db_create(db)
Exemplo n.º 11
0
def db_empty():
    "Will drop every datas stocked in db."
    with application.app_context():
        populate_g()
        web.models.db_empty(db)
Exemplo n.º 12
0
def db_create():
    "Will create the database from conf parameters."
    with application.app_context():
        populate_g()
        web.models.db_create(db)
Exemplo n.º 13
0
def db_empty():
    "Will drop every datas stocked in db."
    with application.app_context():
        populate_g()
        web.models.db_empty(db)