def success(self, response=None, status_code=200, user_message=None,
              dev_message=None):
     self.set_header("Content-Type", "application/json; charset=UTF-8")
     if user_message is not None:
         self.set_header("X-User-Message", user_message)
     if dev_message is not None:
         self.set_header("X-Dev-Message", dev_message)
     self.write(JSONParser.to_json(response))
 def post(self):
     consent_data = JSONParser.to_collection(self.request.body)
     serv = AuthorizationService()
     result = serv.consent(consent_data)
     self.success(response=result)
 def _json(self, status_code, message, data):
     self.set_header("Content-Type", "application/json; charset=UTF-8")
     response = JSONParser.to_json({"status": status_code,
                                    "message": message, "data": data})
     self.write(response)
 def post(self):
     sign_up_data = JSONParser.to_collection(self.request.body)
     serv = AuthorizationService()
     result = serv.signup(sign_up_data)
     self.success(response=result)