@@ -484,7 +484,8 @@ def get_object(self, Bucket, Key, **kwargs):
484484
485485 return response
486486
487- def get_object_sensitive_content_recognition (self , Bucket , Key , DetectType = None , Interval = None , MaxFrames = None , BizType = None , DetectUrl = None , LargeImageDetect = None , ** kwargs ):
487+ def get_object_sensitive_content_recognition (self , Bucket , Key , DetectType = None , Interval = None , MaxFrames = None , BizType = None , DetectUrl = None , LargeImageDetect = None ,
488+ DataId = None , ** kwargs ):
488489 """文件内容识别接口 https://cloud.tencent.com/document/product/460/37318
489490
490491 :param Bucket(string): 存储桶名称.
@@ -497,6 +498,7 @@ def get_object_sensitive_content_recognition(self, Bucket, Key, DetectType=None,
497498 填写了detect-url时,后台会审核detect-url链接,无需再填写ObjectKey。 detect-url示例:http://www.example.com/abc.jpg.
498499 :param LargeImageDetect(int): 对于超过大小限制的图片是否进行压缩后再审核,取值为: 0(不压缩),1(压缩)。默认为0。
499500 注:压缩最大支持32M的图片,且会收取压缩费用。
501+ :param DataId(string): 图片标识,该字段在结果中返回原始内容,长度限制为512字节.
500502 :param kwargs(dict): 设置下载的headers.
501503 :return(dict): 下载成功返回的结果,dict类型.
502504
@@ -558,6 +560,8 @@ def get_object_sensitive_content_recognition(self, Bucket, Key, DetectType=None,
558560 params ['detect-url' ] = DetectUrl
559561 if LargeImageDetect :
560562 params ['large-image-detect' ] = LargeImageDetect
563+ if DataId :
564+ params ['dataid' ] = DataId
561565 params = format_values (params )
562566
563567 url = self ._conf .uri (bucket = Bucket , path = Key )
@@ -574,7 +578,7 @@ def get_object_sensitive_content_recognition(self, Bucket, Key, DetectType=None,
574578 params = params ,
575579 headers = headers )
576580
577- logging .debug ("get object sensitive content recognition rsp:%s" , rt .content )
581+ logger .debug ("get object sensitive content recognition rsp:%s" , rt .content )
578582 data = xml_to_dict (rt .content )
579583 # format res
580584 if 'PornInfo' in data :
@@ -4646,7 +4650,7 @@ def ci_get_object_qrcode(self, Bucket, Key, Cover, **kwargs):
46464650 data = xml_to_dict (rt .content )
46474651 return response , data
46484652
4649- def ci_auditing_submit_common (self , Bucket , Key , DetectType , Type , Url = None , BizType = None , Conf = {}, Input = None , ** kwargs ):
4653+ def ci_auditing_submit_common (self , Bucket , Key , DetectType , Type , Url = None , BizType = None , Conf = {}, Input = None , UserInfo = None , DataId = None , RequestType = None , ** kwargs ):
46504654 """通用提交审核任务接口 https://cloud.tencent.com/document/product/460/46427
46514655
46524656 :param Bucket(string): 存储桶名称.
@@ -4657,6 +4661,8 @@ def ci_auditing_submit_common(self, Bucket, Key, DetectType, Type, Url=None, Biz
46574661 :param Conf(dic): 审核的个性化配置
46584662 :param Input(dic): Input的个性化配置,dict类型,可跟restful api对应查询
46594663 :param BizType(string): 审核策略的唯一标识,由后台自动生成,在控制台中对应为Biztype值.
4664+ :param UserInfo(dict): 用户业务字段.
4665+ :param DataId(string): 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
46604666 :param kwargs(dict): 设置请求的headers.
46614667 :return(dict): 下载成功返回的结果,dict类型.
46624668
@@ -4702,17 +4708,24 @@ def ci_auditing_submit_common(self, Bucket, Key, DetectType, Type, Url=None, Biz
47024708
47034709 if Input :
47044710 request ['Input' ] = Input
4711+ if UserInfo :
4712+ request ['Input' ]['UserInfo' ] = UserInfo
4713+ if DataId :
4714+ request ['Input' ]['DataId' ] = DataId
4715+ if RequestType :
4716+ request ['Type' ] = RequestType
47054717
47064718 xml_request = format_xml (data = request , root = 'Request' )
47074719 headers ['Content-Type' ] = 'application/xml'
47084720
47094721 path = Type + '/auditing'
47104722 url = self ._conf .uri (bucket = Bucket , path = path , endpoint = self ._conf ._endpoint_ci )
4711- logger .info ("ci auditing {type} job submit, url=:{url} ,headers=:{headers}, params=:{params}, ci_endpoint=:{ci_endpoint}" .format (
4723+ logger .debug ("ci auditing {type} job submit, url=:{url} ,headers=:{headers}, params=:{params}, request=:{request }, ci_endpoint=:{ci_endpoint}" .format (
47124724 type = Type ,
47134725 url = url ,
47144726 headers = headers ,
47154727 params = params ,
4728+ request = request ,
47164729 ci_endpoint = self ._conf ._endpoint_ci ))
47174730 rt = self .send_request (
47184731 method = 'POST' ,
@@ -4723,7 +4736,7 @@ def ci_auditing_submit_common(self, Bucket, Key, DetectType, Type, Url=None, Biz
47234736 params = params ,
47244737 headers = headers )
47254738
4726- logging .debug ("ci auditing rsp:%s" , rt .content )
4739+ logger .debug ("ci auditing rsp:%s" , rt .content )
47274740 data = xml_to_dict (rt .content )
47284741
47294742 return data
@@ -4776,13 +4789,13 @@ def ci_auditing_query_common(self, Bucket, Type, JobID, **kwargs):
47764789 params = params ,
47774790 headers = headers )
47784791
4779- logging .debug ("query ci auditing:%s" , rt .content )
4792+ logger .debug ("query ci auditing:%s" , rt .content )
47804793 data = xml_to_dict (rt .content )
47814794
47824795 return data
47834796
47844797 def ci_auditing_video_submit (self , Bucket , Key , DetectType = None , Url = None , Callback = None , CallbackVersion = 'Simple' , DetectContent = 0 , Mode = 'Interval' , Count = 100 , TimeInterval = 1.0 ,
4785- BizType = None , ** kwargs ):
4798+ BizType = None , DataId = None , UserInfo = None , ** kwargs ):
47864799 """提交video审核任务接口 https://cloud.tencent.com/document/product/460/46427
47874800
47884801 :param Bucket(string): 存储桶名称.
@@ -4799,6 +4812,8 @@ def ci_auditing_video_submit(self, Bucket, Key, DetectType=None, Url=None, Callb
47994812 :param Count(int): 视频截帧数量,范围为(0, 10000]。
48004813 :param TimeInterval(int): 视频截帧频率,范围为(0, 60],单位为秒,支持 float 格式,执行精度精确到毫秒。
48014814 :param BizType(string): 审核策略的唯一标识,由后台自动生成,在控制台中对应为Biztype值.
4815+ :param UserInfo(dict): 用户业务字段.
4816+ :param DataId(string): 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
48024817 :param kwargs(dict): 设置请求的headers.
48034818 :return(dict): 任务提交成功返回的结果,dict类型.
48044819
@@ -4839,6 +4854,8 @@ def ci_auditing_video_submit(self, Bucket, Key, DetectType=None, Url=None, Callb
48394854 Conf = conf ,
48404855 Url = Url ,
48414856 DetectType = DetectType ,
4857+ UserInfo = UserInfo ,
4858+ DataId = DataId ,
48424859 ** kwargs
48434860 )
48444861
@@ -4906,7 +4923,8 @@ def ci_auditing_video_query(self, Bucket, JobID, **kwargs):
49064923
49074924 return data
49084925
4909- def ci_auditing_audio_submit (self , Bucket , Key , DetectType = None , Url = None , Callback = None , CallbackVersion = 'Simple' , BizType = None , ** kwargs ):
4926+ def ci_auditing_audio_submit (self , Bucket , Key , DetectType = None , Url = None , Callback = None , CallbackVersion = 'Simple' , BizType = None , UserInfo = None ,
4927+ DataId = None , ** kwargs ):
49104928 """提交音频审核任务接口 https://cloud.tencent.com/document/product/460/53395
49114929
49124930 :param Bucket(string): 存储桶名称.
@@ -4916,6 +4934,8 @@ def ci_auditing_audio_submit(self, Bucket, Key, DetectType=None, Url=None, Callb
49164934 :param Callback(string): 回调地址,以http://或者https://开头的地址。
49174935 :param CallbackVersion(string): 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。
49184936 :param BizType(string): 审核策略的唯一标识,由后台自动生成,在控制台中对应为Biztype值.
4937+ :param UserInfo(dict): 用户业务字段.
4938+ :param DataId(string): 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
49194939 :param kwargs(dict): 设置请求的headers.
49204940 :return(dict): 任务提交成功返回的结果,dict类型.
49214941
@@ -4949,6 +4969,8 @@ def ci_auditing_audio_submit(self, Bucket, Key, DetectType=None, Url=None, Callb
49494969 Conf = conf ,
49504970 Url = Url ,
49514971 DetectType = DetectType ,
4972+ UserInfo = UserInfo ,
4973+ DataId = DataId ,
49524974 ** kwargs
49534975 )
49544976
@@ -4993,7 +5015,7 @@ def ci_auditing_audio_query(self, Bucket, JobID, **kwargs):
49935015
49945016 return data
49955017
4996- def ci_auditing_text_submit (self , Bucket , Key , DetectType = None , Content = None , Callback = None , BizType = None , Url = None , ** kwargs ):
5018+ def ci_auditing_text_submit (self , Bucket , Key , DetectType = None , Content = None , Callback = None , BizType = None , Url = None , UserInfo = None , DataId = None , ** kwargs ):
49975019 """提交文本审核任务接口 https://cloud.tencent.com/document/product/460/56285
49985020
49995021 :param Bucket(string): 存储桶名称.
@@ -5003,6 +5025,8 @@ def ci_auditing_text_submit(self, Bucket, Key, DetectType=None, Content=None, Ca
50035025 :param DetectType(int): 内容识别标志,位计算 1:porn, 8:ads
50045026 :param Callback(string): 回调地址,以http://或者https://开头的地址。
50055027 :param BizType(string): 审核策略的唯一标识,由后台自动生成,在控制台中对应为Biztype值.
5028+ :param UserInfo(dict): 用户业务字段.
5029+ :param DataId(string): 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
50065030 :param kwargs(dict): 设置请求的headers.
50075031 :return(dict): 任务提交成功返回的结果,dict类型.
50085032
@@ -5042,6 +5066,8 @@ def ci_auditing_text_submit(self, Bucket, Key, DetectType=None, Content=None, Ca
50425066 Conf = conf ,
50435067 DetectType = DetectType ,
50445068 Input = Input ,
5069+ UserInfo = UserInfo ,
5070+ DataId = DataId ,
50455071 ** kwargs
50465072 )
50475073
@@ -5080,7 +5106,7 @@ def ci_auditing_text_query(self, Bucket, JobID, **kwargs):
50805106 format_dict (data ['JobsDetail' ], ['Section' ])
50815107 return data
50825108
5083- def ci_auditing_document_submit (self , Bucket , Url , DetectType = None , Key = None , Type = None , Callback = None , BizType = None , ** kwargs ):
5109+ def ci_auditing_document_submit (self , Bucket , Url , DetectType = None , Key = None , Type = None , Callback = None , BizType = None , UserInfo = None , DataId = None , ** kwargs ):
50845110 """提交文档审核任务接口 https://cloud.tencent.com/document/product/460/59380
50855111
50865112 :param Bucket(string): 存储桶名称.
@@ -5091,6 +5117,8 @@ def ci_auditing_document_submit(self, Bucket, Url, DetectType=None, Key=None, Ty
50915117 如果文件没有后缀,该字段必须指定,否则会审核失败。例如:doc、docx、ppt、pptx 等
50925118 :param Callback(string): 回调地址,以http://或者https://开头的地址。
50935119 :param BizType(string): 审核策略的唯一标识,由后台自动生成,在控制台中对应为Biztype值.
5120+ :param UserInfo(dict): 用户业务字段.
5121+ :param DataId(string): 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
50945122 :param kwargs(dict): 设置请求的headers.
50955123 :return(dict):任务提交成功返回的结果,dict类型.
50965124
@@ -5129,6 +5157,8 @@ def ci_auditing_document_submit(self, Bucket, Url, DetectType=None, Key=None, Ty
51295157 Conf = conf ,
51305158 DetectType = DetectType ,
51315159 Input = Input ,
5160+ UserInfo = UserInfo ,
5161+ DataId = DataId ,
51325162 ** kwargs
51335163 )
51345164
@@ -5181,7 +5211,7 @@ def ci_auditing_document_query(self, Bucket, JobID, **kwargs):
51815211
51825212 return data
51835213
5184- def ci_auditing_html_submit (self , Bucket , Url , DetectType = None , ReturnHighlightHtml = False , Callback = None , BizType = None , ** kwargs ):
5214+ def ci_auditing_html_submit (self , Bucket , Url , DetectType = None , ReturnHighlightHtml = False , Callback = None , BizType = None , UserInfo = None , DataId = None , ** kwargs ):
51855215 """提交网页审核任务接口 https://cloud.tencent.com/document/product/436/63958
51865216
51875217 :param Bucket(string): 存储桶名称.
@@ -5191,6 +5221,8 @@ def ci_auditing_html_submit(self, Bucket, Url, DetectType=None, ReturnHighlightH
51915221 html 内容。取值为 true 或者 false,默认为 false。
51925222 :param Callback(string): 回调地址,以http://或者https://开头的地址。
51935223 :param BizType(string): 审核策略的唯一标识,由后台自动生成,在控制台中对应为Biztype值.
5224+ :param UserInfo(dict): 用户业务字段.
5225+ :param DataId(string): 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
51945226 :param kwargs(dict): 设置请求的headers.
51955227 :return(dict):任务提交成功返回的结果,dict类型.
51965228
@@ -5227,6 +5259,8 @@ def ci_auditing_html_submit(self, Bucket, Url, DetectType=None, ReturnHighlightH
52275259 Conf = conf ,
52285260 DetectType = DetectType ,
52295261 Input = Input ,
5262+ UserInfo = UserInfo ,
5263+ DataId = DataId ,
52305264 ** kwargs
52315265 )
52325266
@@ -5296,6 +5330,8 @@ def ci_auditing_image_batch(self, Bucket, Input, DetectType=None, BizType=None,
52965330 DataId: 图片标识,该字段在结果中返回原始内容,长度限制为512字节
52975331 LargeImageDetect: 对于超过大小限制的图片是否进行压缩后再审核,取值为: 0(不压缩),1(压缩)。默认为0。
52985332 注:压缩最大支持32M的图片,且会收取压缩费用。
5333+ DataId: 图片标识,该字段在结果中返回原始内容,长度限制为512字节
5334+ UserInfo: 用户业务字段。
52995335 :param DetectType(int): 内容识别标志,位计算 1:porn, 8:ads
53005336 :param BizType(string): 审核策略的唯一标识,由后台自动生成,在控制台中对应为Biztype值.
53015337 :param kwargs(dict): 设置请求的headers.
@@ -5374,7 +5410,7 @@ def ci_auditing_image_batch(self, Bucket, Input, DetectType=None, BizType=None,
53745410 params = params ,
53755411 headers = headers )
53765412
5377- logging .debug ("ci auditing rsp:%s" , rt .content )
5413+ logger .debug ("ci auditing rsp:%s" , rt .content )
53785414 data = xml_to_dict (rt .content )
53795415
53805416 if 'JobsDetail' in data :
@@ -5447,6 +5483,109 @@ def ci_auditing_image_query(self, Bucket, JobID, **kwargs):
54475483
54485484 return data
54495485
5486+ def ci_auditing_live_video_submit (self , Bucket , BizType , DetectType = None , Url = None , DataId = None , Callback = None , CallbackType = None ,
5487+ UserInfo = None , ** kwargs ):
5488+ """提交直播流审核任务接口 https://cloud.tencent.com/document/product/460/46427
5489+
5490+ :param Bucket(string): 存储桶名称.
5491+ :param Key(string): COS路径.
5492+ :param Url(string): 支持直接传非cos上url过来审核
5493+ :param DetectType(int): 内容识别标志,位计算 1:porn, 8:ads
5494+ :param DataId(string): 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。
5495+ :param Callback(string): 回调地址,以http://或者https://开头的地址。
5496+ :param CallbackType(int): 回调片段类型,有效值:1(回调全部截帧和音频片段)、2(回调违规截帧和音频片段)。默认为 1。
5497+ :param BizType(string): 审核策略的唯一标识,由后台自动生成,在控制台中对应为Biztype值.
5498+ :param UserInfo(dict): 用户业务字段.
5499+ :param kwargs(dict): 设置请求的headers.
5500+ :return(dict): 任务提交成功返回的结果,dict类型.
5501+
5502+ .. code-block:: python
5503+
5504+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
5505+ client = CosS3Client(config)
5506+ # 识别cos上的视频
5507+ response = client.ci_auditing_live_video_submit(
5508+ Bucket='bucket',
5509+ DetectType=CiDetectType.PORN,
5510+ BizType='xxxxx',
5511+ Url='test.mp4'
5512+ )
5513+ print response
5514+ """
5515+
5516+ conf = {
5517+ }
5518+
5519+ if Callback :
5520+ conf ['Callback' ] = Callback
5521+
5522+ if CallbackType :
5523+ conf ['CallbackType' ] = CallbackType
5524+
5525+ return self .ci_auditing_submit_common (
5526+ Bucket = Bucket ,
5527+ Type = 'video' ,
5528+ Key = None ,
5529+ BizType = BizType ,
5530+ Conf = conf ,
5531+ Url = Url ,
5532+ DetectType = DetectType ,
5533+ RequestType = 'live_video' ,
5534+ DataId = DataId ,
5535+ UserInfo = UserInfo ,
5536+ ** kwargs
5537+ )
5538+
5539+ def ci_auditing_live_video_cancle (self , Bucket , JobID , ** kwargs ):
5540+ """取消直播流审核任务接口 https://cloud.tencent.com/document/product/460/46926
5541+
5542+ :param Bucket(string): 存储桶名称.
5543+ :param JobID(string): 任务id.
5544+ :param kwargs(dict): 设置请求的headers.
5545+ :return(dict): 下载成功返回的结果,dict类型.
5546+
5547+ .. code-block:: python
5548+
5549+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
5550+ client = CosS3Client(config)
5551+ # 取消直播流
5552+ response = client.ci_auditing_live_video_cancle(
5553+ Bucket='bucket',
5554+ JobID='v11122zxxxazzz',
5555+ )
5556+ print response
5557+ """
5558+ headers = mapped (kwargs )
5559+ final_headers = {}
5560+ params = {}
5561+ for key in headers :
5562+ if key .startswith ("response" ):
5563+ params [key ] = headers [key ]
5564+ else :
5565+ final_headers [key ] = headers [key ]
5566+ headers = final_headers
5567+
5568+ params = format_values (params )
5569+
5570+ path = '/video/cancel_auditing/' + JobID
5571+ url = self ._conf .uri (bucket = Bucket , path = path , endpoint = self ._conf ._endpoint_ci )
5572+ logger .info ("live video canlce result, url=:{url} ,headers=:{headers}, params=:{params}" .format (
5573+ url = url ,
5574+ headers = headers ,
5575+ params = params ))
5576+ rt = self .send_request (
5577+ method = 'POST' ,
5578+ url = url ,
5579+ bucket = Bucket ,
5580+ auth = CosS3Auth (self ._conf , path , params = params ),
5581+ params = params ,
5582+ headers = headers )
5583+
5584+ logger .debug ("live video canlce:%s" , rt .content )
5585+ data = xml_to_dict (rt .content )
5586+
5587+ return data
5588+
54505589 def ci_auditing_virus_submit (self , Bucket , Key = None , Url = None , Callback = None , ** kwargs ):
54515590 """提交病毒审核任务接口 https://cloud.tencent.com/document/product/460/63964
54525591
@@ -5514,7 +5653,7 @@ def ci_auditing_virus_submit(self, Bucket, Key=None, Url=None, Callback=None, **
55145653 params = params ,
55155654 headers = headers )
55165655
5517- logging .debug ("ci auditing rsp:%s" , rt .content )
5656+ logger .debug ("ci auditing rsp:%s" , rt .content )
55185657 data = xml_to_dict (rt .content )
55195658
55205659 return data
@@ -5565,7 +5704,7 @@ def ci_auditing_virus_query(self, Bucket, JobID, **kwargs):
55655704 params = params ,
55665705 headers = headers )
55675706
5568- logging .debug ("query ci auditing:%s" , rt .content )
5707+ logger .debug ("query ci auditing:%s" , rt .content )
55695708 data = xml_to_dict (rt .content )
55705709
55715710 # 格式化array的输出
0 commit comments