Esempio n. 1
0
Blueprint of the /users route.
This route will be registered in `server.py`.

'''
import os
import flask
import app.utilities.load as Load

from rq import Queue
from redis import Redis

from app.classes.ckan import CKAN
from app.functions.manage_queue import getStatus
from app.functions.fetch_store import fetchAndStore

ckan = CKAN().init()
REDIS_HOST = os.environ.get('REDIS_PORT_6379_TCP_ADDR')
blueprint_users = flask.Blueprint('users', __name__)

@blueprint_users.route('/users')
def computeUsers():
    '''
    Computes information about all users from a
    CKAN instance.

    '''
    key = 'users'
    status = getStatus(key)
    queue = Queue(connection=Redis(host=REDIS_HOST), name=key)
    objects = ckan.action.user_list()
    if status['empty']:
 def __init__(self, id):
     self.id = id
     self.ckan = CKAN().init()
Esempio n. 3
0
 def __init__(self, id):
   self.id = id
   self.ckan = CKAN().init()
   self.categories = ['Update', 'Create', 'Delete']