def catch(request, *args, **kwargs): try: back = func(request, *args, **kwargs) return back except Exception as e: logging.exception(str(e)) return output.ErrorResponse(msg=str(e))
def get(self, request, *args, **kwargs): params = DictToObj(request.params) r = add.delay(4, 12) result = r.wait() logging.info("ok!") if not result: return output.ErrorResponse(msg="fail,no result", status=500) return output.NormalResponse({'detail': result}, status=200)
def post(self, request, *args, **kwargs): return output.ErrorResponse(msg="Please give correct path", status=500)