媒体处理 MPC-Python SDK:代码示例

时间:2024-10-24 20:24:06

代码示例

调用前请根据实际情况替换如下变量:"SDK_AK"、"SDK_SK"、{your endpoint string} 以及 {your project id}。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# coding: utf-8

from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcore.http.http_config import HttpConfig
from huaweicloudsdkmpc.v1 import *

def list_transcoding_task(client):
    try:
        request = ListTranscodingTaskRequest(task_id = [1900293])
        response = client.list_transcoding_task(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

if __name__ == "__main__":
    
    ak = os.environ["SDK_AK"]
    sk = os.environ["SDK_SK"]
    project_id = os.environ["{your project id}"]
    endpoint = "{your endpoint}"

    config = HttpConfig.get_default_config()
    config.ignore_ssl_verification = True
    credentials = BasicCredentials(ak, sk, project_id)

    mpc_client = MpcClient.new_builder(MpcClient) \
        .with_http_config(config) \
        .with_credentials(credentials) \
        .with_endpoint(endpoint) \
        .build()
    
list_transcoding_task(mpc_client)
support.huaweicloud.com/sdkreference-mpc/mpc_05_0076.html