本文为您提供了服务端 Python SDK 的点播 CDN 模块的接口调用示例。
接口请求参数和返回参数说明详见创建域名。
# coding:utf-8 from __future__ import print_function from volcengine.vod.VodService import VodService from volcengine.vod.models.request.request_vod_pb2 import VodCreateDomainV2Request 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 = VodCreateDomainV2Request() req.SpaceName = 'your space name' resp = vod_service.create_domain(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 VodStartDomainRequest 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 = VodStartDomainRequest() resp = vod_service.start_domain(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 VodStopDomainRequest 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 = VodStopDomainRequest() resp = vod_service.stop_domain(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 VodDeleteDomainRequest 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 = VodDeleteDomainRequest() resp = vod_service.delete_domain(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 VodListDomainRequest 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 = VodListDomainRequest() req.SpaceName = 'your space name' resp = vod_service.list_domain(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 VodAddDomainToSchedulerRequest 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 = VodAddDomainToSchedulerRequest() resp = vod_service.add_domain_to_scheduler(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 VodRemoveDomainFromSchedulerRequest 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 = VodRemoveDomainFromSchedulerRequest() resp = vod_service.remove_domain_from_scheduler(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 VodUpdateDomainPlayRuleRequest 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 = VodUpdateDomainPlayRuleRequest() req.DefaultDomain = 'a.b.c' resp = vod_service.update_domain_play_rule(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 VodUpdateDomainExpireV2Request 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 = VodUpdateDomainExpireV2Request() req.SpaceName = 'your space name' resp = vod_service.update_domain_expire(req) except Exception: raise else: print(resp) if resp.ResponseMetadata.Error.Code != '': print(resp.ResponseMetadata.Error)
接口请求参数和返回参数说明详见修改域名 URL 鉴权配置。
# coding:utf-8 from __future__ import print_function from volcengine.vod.VodService import VodService from volcengine.vod.models.request.request_vod_pb2 import VodUpdateDomainUrlAuthConfigV2Request 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 = VodUpdateDomainUrlAuthConfigV2Request() req.SpaceName = 'your space name' req.DomainType= 'your DomainType' req.Domain = 'your Domain' req.MainKey = 'your MainKey' req.BackupKey = 'your BackupKey' req.Status = 'your Status' resp = vod_service.update_domain_url_auth_config(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 VodCreateCdnRefreshTaskRequest 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 = VodCreateCdnRefreshTaskRequest() req.SpaceName = 'your space name' resp = vod_service.create_cdn_refresh_task(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 VodCreateCdnPreloadTaskRequest 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 = VodCreateCdnPreloadTaskRequest() req.SpaceName = 'your space name' resp = vod_service.create_cdn_preload_task(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 VodListCdnTasksRequest 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 = VodListCdnTasksRequest() req.SpaceName = 'your space name' req.TaskId = 'your task_id' req.DomainName = 'your domain' req.TaskType = 'your task type' req.Status = 'your status' req.StartTimestamp = 0 req.EndTimestamp = 0 req.PageNum = 1 req.PageSize = 10 resp = vod_service.list_cdn_tasks(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 VodListCdnAccessLogRequest 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 = VodListCdnAccessLogRequest() req.SpaceName = 'your space name' req.Domains = 'your domian' req.StartTimestamp = 0 req.EndTimestamp = 0 resp = vod_service.list_cdn_access_log(req) except Exception: raise else: print(resp) if resp.ResponseMetadata.Error.Code != '': print(resp.ResponseMetadata.Error)