You need to enable JavaScript to run this app.
导航

其他配置

最近更新时间2022.08.03 11:07:54

首次发布时间2022.08.03 11:07:54

本文为您提供了服务端 Python SDK 的其他配置模块相关的 API 调用示例。主要包含:获取回调事件、添加回调订阅地址等。

初始化

使用前请先完成初始化,参考初始化

获取回调事件

接口请求参数和返回参数详见 OpenAPI:获取回调事件

# coding:utf-8
from __future__ import print_function

from volcengine.vod.VodService import VodService
from volcengine.vod.models.request.request_vod_pb2 import VodSetCallbackEventRequest

if __name__ == '__main__':
    vod_service = VodService()
    # call below method if you dont set ak and sk in $HOME/.vcloud/config
    vod_service.set_ak('your ak')
    vod_service.set_sk('your sk')
    try:
        req = VodSetCallbackEventRequest()
        req.SpaceName = 'your space name'
        # AuthEnabled 1: enable;0: disable
        req.AuthEnabled = '1'
        req.PrivateKey = 'your private key'
        resp = vod_service.set_callback_event(req)
    except Exception:
        raise
    else:
        print(resp)
        if resp.ResponseMetadata.Error.Code != '':
            print(resp.ResponseMetadata.Error)

添加回调订阅地址

接口请求参数和返回参数详见 OpenAPI:添加回调订阅地址

# coding:utf-8
from __future__ import print_function

from volcengine.vod.VodService import VodService
from volcengine.vod.models.request.request_vod_pb2 import VodAddCallbackSubscriptionRequest

if __name__ == '__main__':
    vod_service = VodService()
    # call below method if you dont set ak and sk in $HOME/.vcloud/config
    vod_service.set_ak('your ak')
    vod_service.set_sk('your sk')
    try:
        req = VodAddCallbackSubscriptionRequest()
        req.SpaceName = 'your space name'
        req.Url = 'your url'
        req.ContentType = 'your ContentType'
        resp = vod_service.add_callback_subscription(req)
    except Exception:
        raise
    else:
        print(resp)
        if resp.ResponseMetadata.Error.Code != '':
            print(resp.ResponseMetadata.Error)