本文为您提供了服务端 Python SDK 的其他配置模块的接口调用示例。
接口请求参数和返回参数说明详见设置回调事件。
# 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__': # Create a VOD instance in the specified region. # vod_service = VodService('cn-north-1') vod_service = VodService() # Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65646. # The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. # During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. # 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)
接口请求参数和返回参数说明详见添加回调订阅地址。
# 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__': # Create a VOD instance in the specified region. # vod_service = VodService('cn-north-1') vod_service = VodService() # Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65646. # The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. # During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. # 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)