Example #1
0
 def handle(self, d):
     try:
         args = self._convert_to_arg_list(d)
         rslt = self._call_func(args)
         body = self._translate_result_body(rslt)
         ctx = Context.curctx()
         return Response(resps.STATUS_200, body, ctx.response_headers, ctx.response_cookies)
     except Response, r:
         return r
Example #2
0
def call_internal_api(api, **fields):
    ctx = Context.curctx()
    key = generate_auth_key(ctx.publisher_id, ctx.manager_id, ctx.role)
    headers = { 'INTERNAL-AUTHORIZATION' : key }
    return call_api(api, headers, **fields)
Example #3
0
 def handle(self, d):
     Context.curctx().header('Content-Type', 'application/json; charset=utf-8')
     for k in d:
         d[k] = json2.loads(d[k])
     return super(json_handler, self).handle(d)
Example #4
0
def call_internal_api(api, **fields):
    ctx = Context.curctx()
    key = generate_auth_key(ctx.publisher_id, ctx.manager_id, ctx.role)
    headers = {'INTERNAL-AUTHORIZATION': key}
    return call_api(api, headers, **fields)