示例#1
0
    def post(self):
        json_data = request.get_json(force=True)
        app_context.init()
        app_context.application_context = json_data
        log_info("Resource Vision_OCR service started", app_context.application_context)

        try:
            error_validator = ValidationResponse(DOWNLOAD_FOLDER)
            if error_validator.format_error(json_data) is True:
                response_gen = Response(json_data, DOWNLOAD_FOLDER)
                response = response_gen.nonwf_response()
                log_info("Resource Vision_OCR api response completed", app_context.application_context)
                return jsonify(response)
        except FormatError as e:
            log_error("Resource Vision_OCR Input json format is not correct or dict_key is missing", app_context.application_context, e)
            return Status.ERR_request_input_format.value
示例#2
0
 def post(self):
     log_info("Resource BlockMerger", "Block-merger service started", None)
     json_data = request.get_json(force=True)
     try:
         error_validator = ValidationResponse(DOWNLOAD_FOLDER)
         if error_validator.format_error(json_data) is True:
             response_gen = Response(json_data, DOWNLOAD_FOLDER)
             response = response_gen.nonwf_response()
             log_info("Resource BlockMerger",
                      "Block-merger api response completed", None)
             return jsonify(response)
     except FormatError as e:
         log_error(
             "Resource BlockMerger",
             "Input json format is not correct or dict_key is missing",
             None, e)
         return Status.ERR_request_input_format.value