Exemplo n.º 1
0
 def dispatch_request(self, **kwargs):
     """
     get response format:
         {
             error_code: error_code,
             data: {data_key: data(may be null)}
         }
     """
     try:
         data = self.get_data(**kwargs)
         return make_api_response(error_code=SUCCESS, data={self.data_key: data})
     except ValueError, e:
         return make_api_response(error_code=e.message, data=None)
Exemplo n.º 2
0
 def dispatch_request(self, **kwargs):
     """
     post response format:
         {
             error_code: error_code(0 is success),
             data: data(may be null)
         }
     """
     try:
         data = get_post_data()
         rv = self.proc_data(data, **kwargs)
         return make_api_response(error_code=SUCCESS, data=rv)
     except ValueError, e:
         return make_api_response(error_code=e.message, data=None)