示例#1
0
 def setUpClass(cls):
     cls.s = SuggestEngine(redis_client)
示例#2
0
async def request_context():
    g.reconcile = ReconcileEngine(app.redis_client, app.http_session)
    g.suggest = SuggestEngine(app.redis_client, app.http_session)
    g.monitoring = Monitoring(app.redis_client)
示例#3
0
import bottle
import json
import time

from bottle import route, run, request, default_app, template, HTTPError, abort, HTTPResponse
from docopt import docopt
from wdreconcile.engine import ReconcileEngine
from wdreconcile.suggest import SuggestEngine
from wdreconcile.monitoring import Monitoring

from config import *

reconcile = ReconcileEngine(redis_client)
suggest = SuggestEngine(redis_client)
monitoring = Monitoring(redis_client)


def jsonp(view):
    def wrapped(*posargs, **kwargs):
        args = {}
        # if we access the args via get(),
        # we can get encoding errors...
        for k in request.forms:
            args[k] = getattr(request.forms, k)
        for k in request.query:
            args[k] = getattr(request.query, k)
        callback = args.get('callback')
        status_code = 200
        try:
            result = view(args, *posargs, **kwargs)
        except (KeyError) as e:  #ValueError, AttributeError, KeyError) as e:
示例#4
0
def suggest_engine(redis_client, http_session, item_store_stub):
    suggest = SuggestEngine(redis_client, http_session)
    suggest.store = item_store_stub
    return suggest