예제 #1
0
    def CreateFileSample(self, request):
        """通过该接口可以将文件新增到样本库

        :param request: 调用CreateFileSample所需参数的结构体。
        :type request: :class:`tencentcloud.cms.v20190321.models.CreateFileSampleRequest`
        :rtype: :class:`tencentcloud.cms.v20190321.models.CreateFileSampleResponse`

        """
        try:
            params = request._serialize()
            body = self.call("CreateFileSample", params)
            response = json.loads(body)
            if "Error" not in response["Response"]:
                model = models.CreateFileSampleResponse()
                model._deserialize(response["Response"])
                return model
            else:
                code = response["Response"]["Error"]["Code"]
                message = response["Response"]["Error"]["Message"]
                reqid = response["Response"]["RequestId"]
                raise TencentCloudSDKException(code, message, reqid)
        except Exception as e:
            if isinstance(e, TencentCloudSDKException):
                raise
            else:
                raise TencentCloudSDKException(e.message, e.message)
예제 #2
0
    def CreateFileSample(self, request):
        """本文档适用于图片内容安全、视频内容安全自定义识别库的管理。
        <br>
        通过该接口可以将图片新增到样本库。

        :param request: Request instance for CreateFileSample.
        :type request: :class:`tencentcloud.cms.v20190321.models.CreateFileSampleRequest`
        :rtype: :class:`tencentcloud.cms.v20190321.models.CreateFileSampleResponse`

        """
        try:
            params = request._serialize()
            headers = request.headers
            body = self.call("CreateFileSample", params, headers=headers)
            response = json.loads(body)
            if "Error" not in response["Response"]:
                model = models.CreateFileSampleResponse()
                model._deserialize(response["Response"])
                return model
            else:
                code = response["Response"]["Error"]["Code"]
                message = response["Response"]["Error"]["Message"]
                reqid = response["Response"]["RequestId"]
                raise TencentCloudSDKException(code, message, reqid)
        except Exception as e:
            if isinstance(e, TencentCloudSDKException):
                raise
            else:
                raise TencentCloudSDKException(e.message, e.message)