示例#1
0
 def dispatch_event(self, event_json):
     try:
         event = TykEvent(event_json)
         event_handler = self.find_event_handler(event.handler_name)
         if event_handler:
             event_handler.process(event)
     except:
         tyk.log_error("Can't dispatch, error:")
示例#2
0
 def dispatch_event(self, event_json):
     try:
         event = TykEvent(event_json)
         api_id = event.spec['APIID']
         middleware, hook_handler = self.find_hook(api_id, event.handler_name)
         middleware.process(hook_handler, event)
     except:
         tyk.log_error( "Can't dispatch: ")
示例#3
0
 def dispatch_event(self, event_json):
     try:
         event = TykEvent(event_json)
         event_handler = self.find_event_handler(event.handler_name)
         if event_handler:
             event_handler.process(event)
     except:
         tyk.log_error( "Can't dispatch, error:")
示例#4
0
 def dispatch_hook(self, object_msg):
     try:
         object = TykCoProcessObject(object_msg)
         middleware, hook_handler = self.find_hook_by_name(object.hook_name)
         if hook_handler:
             object = middleware.process(hook_handler, object)
         else:
             tyk.log( "Can't dispatch '{0}', hook is not defined.".format(object.hook_name), "error")
         return object.dump()
     except:
         tyk.log_error( "Can't dispatch, error:" )
         return object_msg
示例#5
0
 def dispatch_hook(self, object_msg):
     try:
         object = TykCoProcessObject(object_msg)
         api_id = object.spec['APIID']
         middleware, hook_handler = self.find_hook(api_id, object.hook_name)
         if hook_handler:
             object = middleware.process(hook_handler, object)
         else:
             tyk.log( "Can't dispatch '{0}', hook is not defined.".format(object.hook_name), "error")
         return object.dump()
     except:
         tyk.log_error( "Can't dispatch, error:" )
         return object_msg
示例#6
0
    def dispatch_hook(self, object_msg):
        try:
            object = TykCoProcessObject(object_msg)
            middleware, hook_handler = self.find_hook_by_name(object.hook_name)
            if hook_handler:
                object = middleware.process(hook_handler, object)
            else:
                tyk.log(
                    "Can't dispatch '{0}', hook is not defined.".format(
                        object.hook_name), "error")
            return object.dump()
        except:
            exc_trace = traceback.format_exc()
            print(exc_trace)
            tyk.log_error("Can't dispatch, error:")

            return object_msg
示例#7
0
def except_hook(type, value, traceback):
    tyk.log_error("{0}".format(value))