@@ -4816,6 +4816,232 @@ def ci_auditing_document_query(self, Bucket, JobID, **kwargs):
48164816 ** kwargs
48174817 )
48184818
4819+ def ci_get_media_queue (self , Bucket , ** kwargs ):
4820+ """查询媒体处理队列接口 https://cloud.tencent.com/document/product/436/54045
4821+
4822+ :param Bucket(string): 存储桶名称.
4823+ :param kwargs(dict): 设置请求的headers.
4824+ :return(dict): 查询成功返回的结果,dict类型.
4825+
4826+ .. code-block:: python
4827+
4828+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
4829+ client = CosS3Client(config)
4830+ # 查询媒体处理队列接口
4831+ response = client.ci_get_media_queue(
4832+ Bucket='bucket'
4833+ )
4834+ print response
4835+ """
4836+ headers = mapped (kwargs )
4837+ final_headers = {}
4838+ params = {}
4839+ for key in headers :
4840+ if key .startswith ("response" ):
4841+ params [key ] = headers [key ]
4842+ else :
4843+ final_headers [key ] = headers [key ]
4844+ headers = final_headers
4845+
4846+ params = format_values (params )
4847+
4848+ path = "/queue"
4849+ url = self ._conf .uri (bucket = Bucket , path = path , endpoint = self ._conf ._endpoint_ci )
4850+ logger .info ("get_media_queue result, url=:{url} ,headers=:{headers}, params=:{params}" .format (
4851+ url = url ,
4852+ headers = headers ,
4853+ params = params ))
4854+ rt = self .send_request (
4855+ method = 'GET' ,
4856+ url = url ,
4857+ bucket = Bucket ,
4858+ auth = CosS3Auth (self ._conf , path , params = params ),
4859+ params = params ,
4860+ headers = headers )
4861+
4862+ data = xml_to_dict (rt .content )
4863+ # 单个元素时将dict转为list
4864+ format_dict (data , ['QueueList' ])
4865+ return data
4866+
4867+ def ci_create_media_jobs (self , Bucket , Jobs = {}, Lst = {}, ** kwargs ):
4868+ """ 创建任务接口 https://cloud.tencent.com/document/product/436/54013
4869+
4870+ :param Bucket(string): 存储桶名称.
4871+ :param Jobs(dict): 创建任务的配置.
4872+ :param Lst(dict): 创建任务dict转xml时去除Key数组.
4873+ :param kwargs(dict): 设置请求的headers.
4874+ :return(dict): 查询成功返回的结果,dict类型.
4875+
4876+ .. code-block:: python
4877+
4878+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
4879+ client = CosS3Client(config)
4880+ # 创建任务接口
4881+ response = client.ci_create_media_jobs(
4882+ Bucket='bucket'
4883+ Jobs={},
4884+ Lst={}
4885+ )
4886+ print response
4887+ """
4888+ headers = mapped (kwargs )
4889+ final_headers = {}
4890+ params = {}
4891+ for key in headers :
4892+ if key .startswith ("response" ):
4893+ params [key ] = headers [key ]
4894+ else :
4895+ final_headers [key ] = headers [key ]
4896+ headers = final_headers
4897+
4898+ params = format_values (params )
4899+ xml_config = format_xml (data = Jobs , root = 'Request' , lst = Lst )
4900+ path = "/jobs"
4901+ url = self ._conf .uri (bucket = Bucket , path = path , endpoint = self ._conf ._endpoint_ci )
4902+ logger .info ("create_media_jobs result, url=:{url} ,headers=:{headers}, params=:{params}, xml_config=:{xml_config}" .format (
4903+ url = url ,
4904+ headers = headers ,
4905+ params = params ,
4906+ xml_config = xml_config ))
4907+ rt = self .send_request (
4908+ method = 'POST' ,
4909+ url = url ,
4910+ bucket = Bucket ,
4911+ data = xml_config ,
4912+ auth = CosS3Auth (self ._conf , path , params = params ),
4913+ params = params ,
4914+ headers = headers )
4915+
4916+ data = xml_to_dict (rt .content )
4917+ # 单个元素时将dict转为list
4918+ format_dict (data , ['JobsDetail' ])
4919+ return data
4920+
4921+ def ci_get_media_jobs (self , Bucket , JobIDs , ** kwargs ):
4922+ """ 查询任务接口 https://cloud.tencent.com/document/product/436/54010
4923+
4924+ :param Bucket(string): 存储桶名称.
4925+ :param JobIDs(string): 任务ID,以,分割多个任务ID.
4926+ :param kwargs(dict): 设置请求的headers.
4927+ :return(dict): 查询成功返回的结果,dict类型.
4928+
4929+ .. code-block:: python
4930+
4931+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
4932+ client = CosS3Client(config)
4933+ # 创建任务接口
4934+ response = client.ci_get_media_jobs(
4935+ Bucket='bucket'
4936+ JobIDs={}
4937+ )
4938+ print response
4939+ """
4940+ headers = mapped (kwargs )
4941+ final_headers = {}
4942+ params = {}
4943+ for key in headers :
4944+ if key .startswith ("response" ):
4945+ params [key ] = headers [key ]
4946+ else :
4947+ final_headers [key ] = headers [key ]
4948+ headers = final_headers
4949+
4950+ params = format_values (params )
4951+ path = "/jobs/" + JobIDs
4952+ url = self ._conf .uri (bucket = Bucket , path = path , endpoint = self ._conf ._endpoint_ci )
4953+ logger .info ("get_media_jobs result, url=:{url} ,headers=:{headers}, params=:{params}" .format (
4954+ url = url ,
4955+ headers = headers ,
4956+ params = params ))
4957+ rt = self .send_request (
4958+ method = 'GET' ,
4959+ url = url ,
4960+ bucket = Bucket ,
4961+ auth = CosS3Auth (self ._conf , path , params = params ),
4962+ params = params ,
4963+ headers = headers )
4964+ logger .debug ("ci_get_media_jobs result, url=:{url} ,content=:{content}" .format (
4965+ url = url ,
4966+ content = rt .content ))
4967+
4968+ data = xml_to_dict (rt .content )
4969+ # 单个元素时将dict转为list
4970+ format_dict (data , ['JobsDetail' ])
4971+ return data
4972+
4973+ def ci_list_media_jobs (self , Bucket , QueueId , Tag , StartCreationTime = None , EndCreationTime = None , OrderByTime = 'Desc' , States = 'All' , Size = 10 , NextToken = '' , ** kwargs ):
4974+ """ 查询任务接口 https://cloud.tencent.com/document/product/436/54011
4975+
4976+ :param Bucket(string): 存储桶名称.
4977+ :param QueueId(string): 队列ID.
4978+ :param Tag(string): 任务类型.
4979+ :param StartCreationTime(string): 开始时间.
4980+ :param EndCreationTime(string): 结束时间.
4981+ :param OrderByTime(string): 排序方式.
4982+ :param States(string): 任务状态.
4983+ :param Size(string): 任务个数.
4984+ :param NextToken(string): 请求的上下文,用于翻页.
4985+ :param kwargs(dict): 设置请求的headers.
4986+ :return(dict): 查询成功返回的结果,dict类型.
4987+
4988+ .. code-block:: python
4989+
4990+ config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
4991+ client = CosS3Client(config)
4992+ # 创建任务接口
4993+ response = client.ci_get_media_jobs(
4994+ Bucket='bucket'
4995+ QueueId='',
4996+ Tag='Transcode'
4997+ )
4998+ print response
4999+ """
5000+ headers = mapped (kwargs )
5001+ final_headers = {}
5002+ params = {}
5003+ for key in headers :
5004+ if key .startswith ("response" ):
5005+ params [key ] = headers [key ]
5006+ else :
5007+ final_headers [key ] = headers [key ]
5008+ headers = final_headers
5009+
5010+ params = format_values (params )
5011+ path = "/jobs"
5012+ url = self ._conf .uri (bucket = Bucket , path = path , endpoint = self ._conf ._endpoint_ci )
5013+ url = u"{url}?{QueueId}&{Tag}&{OrderByTime}&{States}&{Size}&{NextToken}" .format (
5014+ url = to_unicode (url ),
5015+ QueueId = to_unicode ('queueId=' + QueueId ),
5016+ Tag = to_unicode ('tag=' + Tag ),
5017+ OrderByTime = to_unicode ('orderByTime=' + OrderByTime ),
5018+ States = to_unicode ('states=' + States ),
5019+ Size = to_unicode ('size=' + str (Size )),
5020+ NextToken = to_unicode ('nextToken=' + NextToken )
5021+ )
5022+ if StartCreationTime is not None :
5023+ url = u"{url}&{StartCreationTime}" .format (StartCreationTime = to_unicode ('startCreationTime=' + StartCreationTime ))
5024+ if EndCreationTime is not None :
5025+ url = u"{url}&{EndCreationTime}" .format (EndCreationTime = to_unicode ('endCreationTime=' + EndCreationTime ))
5026+ logger .info ("list_media_jobs result, url=:{url} ,headers=:{headers}, params=:{params}" .format (
5027+ url = url ,
5028+ headers = headers ,
5029+ params = params ))
5030+ rt = self .send_request (
5031+ method = 'GET' ,
5032+ url = url ,
5033+ bucket = Bucket ,
5034+ auth = CosS3Auth (self ._conf , path , params = params ),
5035+ params = params ,
5036+ headers = headers )
5037+ logger .debug ("list_media_jobs result, url=:{url} ,content=:{content}" .format (
5038+ url = url ,
5039+ content = rt .content ))
5040+ data = xml_to_dict (rt .content )
5041+ # 单个元素时将dict转为list
5042+ format_dict (data , ['JobsDetail' ])
5043+ return data
5044+
48195045
48205046if __name__ == "__main__" :
48215047 pass
0 commit comments