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)
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:
def setUpClass(cls): cls.r = ReconcileEngine(redis_client)