byteplus-sdk 1.0.39__tar.gz → 1.0.49__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/PKG-INFO +1 -1
- byteplus-sdk-1.0.49/byteplus_sdk/__init__.py +2 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/cdn/service.py +52 -0
- byteplus-sdk-1.0.49/byteplus_sdk/example/cdn/create_rule_engine_template.py +160 -0
- byteplus-sdk-1.0.49/byteplus_sdk/example/cdn/describe_rule_engine_template.py +23 -0
- byteplus-sdk-1.0.49/byteplus_sdk/example/cdn/release_template.py +23 -0
- byteplus-sdk-1.0.49/byteplus_sdk/example/cdn/update_rule_engine_template.py +61 -0
- byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_get_result.py +19 -0
- byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_process.py +20 -0
- byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_submit_task.py +19 -0
- byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_sync2async_get_result.py +20 -0
- byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_sync2async_submit_task.py +20 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/visual/VisualService.py +57 -2
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/VodService.py +158 -0
- byteplus-sdk-1.0.49/byteplus_sdk/vod/VodServiceConfig.py +130 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_apps_manage_pb2.py +2 -2
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_cdn_pb2.py +67 -47
- byteplus-sdk-1.0.49/byteplus_sdk/vod/models/business/vod_common_pb2.py +322 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_media_pb2.py +143 -93
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_play_pb2.py +11 -1
- byteplus-sdk-1.0.49/byteplus_sdk/vod/models/business/vod_project_pb2.py +45 -0
- byteplus-sdk-1.0.49/byteplus_sdk/vod/models/business/vod_quality_platform_pb2.py +46 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/request/request_vod_pb2.py +330 -219
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/response/response_vod_pb2.py +313 -211
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/PKG-INFO +1 -1
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/SOURCES.txt +11 -0
- byteplus-sdk-1.0.39/byteplus_sdk/__init__.py +0 -2
- byteplus-sdk-1.0.39/byteplus_sdk/vod/VodServiceConfig.py +0 -118
- byteplus-sdk-1.0.39/byteplus_sdk/vod/models/business/vod_common_pb2.py +0 -255
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/LICENSE +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/README.md +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/ApiInfo.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/Credentials.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/Policy.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/ServiceInfo.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/ServiceInfoHttps.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/auth/MetaData.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/auth/SignerV4.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/auth/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/Request.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/Service.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/models/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/models/base/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/models/base/base_pb2.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/cdn/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/const/Const.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/const/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/add_cdn_certificate.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/add_cdn_domain.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/add_template_domain.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/create_cipher_template.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/create_service_template.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/delete_cdn_domain.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/delete_template.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_accounting_data.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_access_log.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_config.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_data.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_data_detail.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_detail.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_origin_data.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_region_and_isp.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_service.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_upper_ip.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cipher_template.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_content_block_tasks.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_content_quota.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_content_tasks.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_nrt_data_summary.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_statistical_data.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_top_nrt_data.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_top_statistical_data.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_top_status_code.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_ip_info.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_ip_list_info.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_origin_nrt_data_summary.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_origin_top_nrt_data.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_origin_top_status_code.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_service_template.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_template_domains.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_templates.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/duplicate_template.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/list_cdn_cert_info.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/list_cdn_domains.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/list_cert_info.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/lock_template.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/start_cdn_domain.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/stop_cdn_domain.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/submit_block_task.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/submit_preload_task.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/submit_refresh_task.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/submit_unblock_task.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/update_cdn_config.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/update_cipher_template.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/update_service_template.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/update_template_domain.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/live/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/rtc/RtcService.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/rtc/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/rtc/example_get_record_task.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/rtc/example_start_record.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/visual/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/visual/example_common.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/iam/IamService.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/iam/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/LiveService.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20200801/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20200801/live_config.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20200801/live_service.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20200801/live_trait.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20230101/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20230101/live_config.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20230101/live_service.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20230101/live_trait.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/sms/SmsService.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/sms/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/util/Functions.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/util/Util.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/util/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/visual/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_callback_pb2.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_edit_pb2.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_measure_pb2.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_smart_strategy_pb2.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_space_pb2.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_upload_pb2.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_workflow_pb2.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/request/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/response/__init__.py +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/dependency_links.txt +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/requires.txt +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/top_level.txt +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/setup.cfg +0 -0
- {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/setup.py +0 -0
|
@@ -174,6 +174,18 @@ api_info = {
|
|
|
174
174
|
"CreateServiceTemplate": ApiInfo("POST", "/", {
|
|
175
175
|
"Action": "CreateServiceTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
176
176
|
|
|
177
|
+
"CreateRuleEngineTemplate": ApiInfo("POST", "/", {
|
|
178
|
+
"Action": "CreateRuleEngineTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
179
|
+
|
|
180
|
+
"UpdateRuleEngineTemplate": ApiInfo("POST", "/", {
|
|
181
|
+
"Action": "UpdateRuleEngineTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
182
|
+
|
|
183
|
+
"DescribeRuleEngineTemplate": ApiInfo("POST", "/", {
|
|
184
|
+
"Action": "DescribeRuleEngineTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
185
|
+
|
|
186
|
+
"ReleaseTemplate": ApiInfo("POST", "/", {
|
|
187
|
+
"Action": "ReleaseTemplate", "Version": SERVICE_VERSION}, {}, {}),
|
|
188
|
+
|
|
177
189
|
"DescribeDistrictData": ApiInfo("POST", "/", {
|
|
178
190
|
"Action": "DescribeDistrictData", "Version": SERVICE_VERSION}, {}, {}),
|
|
179
191
|
|
|
@@ -1049,3 +1061,43 @@ class CDNService(Service):
|
|
|
1049
1061
|
raise Exception("%s: empty response" % action)
|
|
1050
1062
|
res_json = json.loads(res)
|
|
1051
1063
|
return res_json
|
|
1064
|
+
|
|
1065
|
+
def create_rule_engine_template(self, params=None):
|
|
1066
|
+
if params is None:
|
|
1067
|
+
params = {}
|
|
1068
|
+
action = "CreateRuleEngineTemplate"
|
|
1069
|
+
res = self.json(action, [], params)
|
|
1070
|
+
if res == '':
|
|
1071
|
+
raise Exception("%s: empty response" % action)
|
|
1072
|
+
res_json = json.loads(res)
|
|
1073
|
+
return res_json
|
|
1074
|
+
|
|
1075
|
+
def update_rule_engine_template(self, params=None):
|
|
1076
|
+
if params is None:
|
|
1077
|
+
params = {}
|
|
1078
|
+
action = "UpdateRuleEngineTemplate"
|
|
1079
|
+
res = self.json(action, [], params)
|
|
1080
|
+
if res == '':
|
|
1081
|
+
raise Exception("%s: empty response" % action)
|
|
1082
|
+
res_json = json.loads(res)
|
|
1083
|
+
return res_json
|
|
1084
|
+
|
|
1085
|
+
def describe_rule_engine_template(self, params=None):
|
|
1086
|
+
if params is None:
|
|
1087
|
+
params = {}
|
|
1088
|
+
action = "DescribeRuleEngineTemplate"
|
|
1089
|
+
res = self.json(action, [], params)
|
|
1090
|
+
if res == '':
|
|
1091
|
+
raise Exception("%s: empty response" % action)
|
|
1092
|
+
res_json = json.loads(res)
|
|
1093
|
+
return res_json
|
|
1094
|
+
|
|
1095
|
+
def release_template(self, params=None):
|
|
1096
|
+
if params is None:
|
|
1097
|
+
params = {}
|
|
1098
|
+
action = "ReleaseTemplate"
|
|
1099
|
+
res = self.json(action, [], params)
|
|
1100
|
+
if res == '':
|
|
1101
|
+
raise Exception("%s: empty response" % action)
|
|
1102
|
+
res_json = json.loads(res)
|
|
1103
|
+
return res_json
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../../")
|
|
6
|
+
|
|
7
|
+
from byteplus_sdk.example.cdn import ak, sk
|
|
8
|
+
from byteplus_sdk.cdn.service import CDNService
|
|
9
|
+
|
|
10
|
+
from rule_engine.Rule import Condition, Action, Rule
|
|
11
|
+
from rule_engine.Const import Const
|
|
12
|
+
|
|
13
|
+
def example():
|
|
14
|
+
cdn_service = CDNService()
|
|
15
|
+
cdn_service.set_ak(ak)
|
|
16
|
+
cdn_service.set_sk(sk)
|
|
17
|
+
|
|
18
|
+
# Create a rule engine policy that sets the cache time to 0 seconds under any conditions.
|
|
19
|
+
rule = Rule()
|
|
20
|
+
rule.desc = "example"
|
|
21
|
+
rule.if_block.condition = Condition({
|
|
22
|
+
"IsGroup": False,
|
|
23
|
+
"Connective": Const.ConnectiveAnd,
|
|
24
|
+
"Condition": {
|
|
25
|
+
"Object": Const.ConditionAlways,
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
rule.if_block.actions.append(Action({
|
|
29
|
+
"Action": Const.ActionCacheTime,
|
|
30
|
+
"Groups": [{
|
|
31
|
+
"Dimension": Const.ActionCacheTime,
|
|
32
|
+
"GroupParameters": [{
|
|
33
|
+
"Parameters": [
|
|
34
|
+
{
|
|
35
|
+
"Name": "ttl",
|
|
36
|
+
"Values": ["0"]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"Name": "ttl_unit",
|
|
40
|
+
"Values": ["sec"]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"Name": "cache_policy",
|
|
44
|
+
"Values": [Const.CacheDefault]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"Name": "force_cache",
|
|
48
|
+
"Values": ["true"]
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}]
|
|
52
|
+
}]
|
|
53
|
+
}))
|
|
54
|
+
|
|
55
|
+
rsp = cdn_service.create_rule_engine_template({
|
|
56
|
+
"Project": "default",
|
|
57
|
+
"Title": "example",
|
|
58
|
+
"Message": "Under any conditions, set the cache time to 0 seconds",
|
|
59
|
+
"Rule": rule.encode_to_string()
|
|
60
|
+
})
|
|
61
|
+
print(rsp)
|
|
62
|
+
|
|
63
|
+
def example2():
|
|
64
|
+
cdn_service = CDNService()
|
|
65
|
+
cdn_service.set_ak(ak)
|
|
66
|
+
cdn_service.set_sk(sk)
|
|
67
|
+
|
|
68
|
+
# When the Referer request header is equal to 'example', set the HTTP response header 'test' with a value of abc123.
|
|
69
|
+
rule = Rule()
|
|
70
|
+
rule.desc = "example"
|
|
71
|
+
rule.if_block.condition = Condition({
|
|
72
|
+
"IsGroup": False,
|
|
73
|
+
"Connective": Const.ConnectiveAnd,
|
|
74
|
+
"Condition": {
|
|
75
|
+
"Object": Const.ConditionHTTPReferer,
|
|
76
|
+
"Operator": Const.OperatorEqual,
|
|
77
|
+
"Value": ["example"],
|
|
78
|
+
"IgnoreCase": True
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
rule.if_block.actions.append(Action({
|
|
82
|
+
"Action": Const.ConditionResponseHeader,
|
|
83
|
+
"Groups": [{
|
|
84
|
+
"Dimension": Const.ActionResponseHeader,
|
|
85
|
+
"GroupParameters": [{
|
|
86
|
+
"Parameters": [
|
|
87
|
+
{
|
|
88
|
+
"Name": "action",
|
|
89
|
+
"Values": ["set"]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"Name": "header_name",
|
|
93
|
+
"Values": ["test"]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"Name": "header_value",
|
|
97
|
+
"Values": ["abc123"]
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}]
|
|
101
|
+
}]
|
|
102
|
+
}))
|
|
103
|
+
|
|
104
|
+
rsp = cdn_service.create_rule_engine_template({
|
|
105
|
+
"Project": "default",
|
|
106
|
+
"Title": "example2",
|
|
107
|
+
"Message": "When the Referer request header is equal to 'example', set the HTTP response header 'test' with a value of abc123.",
|
|
108
|
+
"Rule": rule.encode_to_string()
|
|
109
|
+
})
|
|
110
|
+
print(rsp)
|
|
111
|
+
|
|
112
|
+
def example3():
|
|
113
|
+
cdn_service = CDNService()
|
|
114
|
+
cdn_service.set_ak(ak)
|
|
115
|
+
cdn_service.set_sk(sk)
|
|
116
|
+
|
|
117
|
+
# URL matching, equal to http://www.example.com/path1?a=1 When case is ignored, the protocol forces a redirect, with a redirect status code of 301 and a redirect protocol of HTTPS
|
|
118
|
+
rule = Rule()
|
|
119
|
+
rule.desc = "example"
|
|
120
|
+
rule.if_block.condition = Condition({
|
|
121
|
+
"IsGroup": False,
|
|
122
|
+
"Connective": Const.ConnectiveAnd,
|
|
123
|
+
"Condition": {
|
|
124
|
+
"Object": Const.ConditionHTTPUrl,
|
|
125
|
+
"Operator": Const.OperatorEqual,
|
|
126
|
+
"Value": ["http://www.test.com/path1?a=1"],
|
|
127
|
+
"IgnoreCase": True
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
rule.if_block.actions.append(Action({
|
|
131
|
+
"Action": Const.ActionRedirectProtocol,
|
|
132
|
+
"Groups": [{
|
|
133
|
+
"Dimension": Const.ActionRedirectProtocol,
|
|
134
|
+
"GroupParameters": [{
|
|
135
|
+
"Parameters": [
|
|
136
|
+
{
|
|
137
|
+
"Name": "status_code",
|
|
138
|
+
"Values": ["301"]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"Name": "protocol",
|
|
142
|
+
"Values": ["https"]
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}]
|
|
146
|
+
}]
|
|
147
|
+
}))
|
|
148
|
+
|
|
149
|
+
rsp = cdn_service.create_rule_engine_template({
|
|
150
|
+
"Project": "default",
|
|
151
|
+
"Title": "example3",
|
|
152
|
+
"Message": "",
|
|
153
|
+
"Rule": rule.encode_to_string()
|
|
154
|
+
})
|
|
155
|
+
print(rsp)
|
|
156
|
+
|
|
157
|
+
if __name__ == '__main__':
|
|
158
|
+
example1()
|
|
159
|
+
example2()
|
|
160
|
+
example3()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../../")
|
|
6
|
+
|
|
7
|
+
from byteplus_sdk.example.cdn import ak, sk
|
|
8
|
+
from byteplus_sdk.cdn.service import CDNService
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def example():
|
|
12
|
+
cdn_service = CDNService()
|
|
13
|
+
cdn_service.set_ak(ak)
|
|
14
|
+
cdn_service.set_sk(sk)
|
|
15
|
+
|
|
16
|
+
rsp = cdn_service.describe_rule_engine_template({
|
|
17
|
+
"TemplateId": "tpl-example",
|
|
18
|
+
})
|
|
19
|
+
print(rsp)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if __name__ == '__main__':
|
|
23
|
+
example()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../../")
|
|
6
|
+
|
|
7
|
+
from byteplus_sdk.example.cdn import ak, sk
|
|
8
|
+
from byteplus_sdk.cdn.service import CDNService
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def example():
|
|
12
|
+
cdn_service = CDNService()
|
|
13
|
+
cdn_service.set_ak(ak)
|
|
14
|
+
cdn_service.set_sk(sk)
|
|
15
|
+
|
|
16
|
+
rsp = cdn_service.release_template({
|
|
17
|
+
"TemplateId": "tpl-example",
|
|
18
|
+
})
|
|
19
|
+
print(rsp)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if __name__ == '__main__':
|
|
23
|
+
example()
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../../")
|
|
6
|
+
|
|
7
|
+
from byteplus_sdk.example.cdn import ak, sk
|
|
8
|
+
from byteplus_sdk.cdn.service import CDNService
|
|
9
|
+
|
|
10
|
+
from rule_engine.Rule import Condition, Action, Rule
|
|
11
|
+
from rule_engine.Const import Const
|
|
12
|
+
|
|
13
|
+
def example():
|
|
14
|
+
cdn_service = CDNService()
|
|
15
|
+
cdn_service.set_ak(ak)
|
|
16
|
+
cdn_service.set_sk(sk)
|
|
17
|
+
|
|
18
|
+
rule = Rule()
|
|
19
|
+
rule.desc = "example"
|
|
20
|
+
rule.if_block.condition = Condition({
|
|
21
|
+
"IsGroup": False,
|
|
22
|
+
"Connective": Const.ConnectiveAnd,
|
|
23
|
+
"Condition": {
|
|
24
|
+
"Object": Const.ConditionAlways,
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
rule.if_block.actions.append(Action({
|
|
28
|
+
"Action": Const.ActionCacheTime,
|
|
29
|
+
"Groups": [{
|
|
30
|
+
"Dimension": Const.ActionCacheTime,
|
|
31
|
+
"GroupParameters": [{
|
|
32
|
+
"Parameters": [
|
|
33
|
+
{
|
|
34
|
+
"Name": "ttl",
|
|
35
|
+
"Values": ["0"]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"Name": "ttl_unit",
|
|
39
|
+
"Values": ["sec"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"Name": "cache_policy",
|
|
43
|
+
"Values": [Const.CacheDefault]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"Name": "force_cache",
|
|
47
|
+
"Values": ["true"]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}]
|
|
51
|
+
}]
|
|
52
|
+
}))
|
|
53
|
+
rsp = cdn_service.update_rule_engine_template({
|
|
54
|
+
"TemplateId": "tpl-example",
|
|
55
|
+
"TemplateVersion": "draft",
|
|
56
|
+
"Rule": rule.encode_to_string()
|
|
57
|
+
})
|
|
58
|
+
print(rsp)
|
|
59
|
+
|
|
60
|
+
if __name__ == '__main__':
|
|
61
|
+
example()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
from __future__ import print_function
|
|
3
|
+
|
|
4
|
+
from byteplus_sdk import visual
|
|
5
|
+
from byteplus_sdk.visual.VisualService import VisualService
|
|
6
|
+
|
|
7
|
+
if __name__ == '__main__':
|
|
8
|
+
visual_service = VisualService()
|
|
9
|
+
|
|
10
|
+
# call below method if you don't set ak and sk in $HOME/.volc/config
|
|
11
|
+
visual_service.set_ak('AK')
|
|
12
|
+
visual_service.set_sk('Sk')
|
|
13
|
+
|
|
14
|
+
form = {
|
|
15
|
+
"req_key": "xxx",
|
|
16
|
+
"task_id": "xxx"
|
|
17
|
+
}
|
|
18
|
+
resp = visual_service.cv_get_result(form)
|
|
19
|
+
print(resp)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
from __future__ import print_function
|
|
3
|
+
|
|
4
|
+
from byteplus_sdk import visual
|
|
5
|
+
from byteplus_sdk.visual.VisualService import VisualService
|
|
6
|
+
|
|
7
|
+
if __name__ == '__main__':
|
|
8
|
+
visual_service = VisualService()
|
|
9
|
+
|
|
10
|
+
# call below method if you don't set ak and sk in $HOME/.volc/config
|
|
11
|
+
visual_service.set_ak('AK')
|
|
12
|
+
visual_service.set_sk('SK')
|
|
13
|
+
|
|
14
|
+
form = {
|
|
15
|
+
"req_key": "xxx",
|
|
16
|
+
# ...
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
resp = visual_service.cv_process(form)
|
|
20
|
+
print(resp)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
from __future__ import print_function
|
|
3
|
+
|
|
4
|
+
from byteplus_sdk import visual
|
|
5
|
+
from byteplus_sdk.visual.VisualService import VisualService
|
|
6
|
+
|
|
7
|
+
if __name__ == '__main__':
|
|
8
|
+
visual_service = VisualService()
|
|
9
|
+
|
|
10
|
+
# call below method if you don't set ak and sk in $HOME/.volc/config
|
|
11
|
+
visual_service.set_ak('AK')
|
|
12
|
+
visual_service.set_sk('SK')
|
|
13
|
+
|
|
14
|
+
form = {
|
|
15
|
+
"req_key": "xxx",
|
|
16
|
+
# ....
|
|
17
|
+
}
|
|
18
|
+
resp = visual_service.cv_submit_task( form)
|
|
19
|
+
print(resp)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
from __future__ import print_function
|
|
3
|
+
|
|
4
|
+
from byteplus_sdk import visual
|
|
5
|
+
from byteplus_sdk.visual.VisualService import VisualService
|
|
6
|
+
|
|
7
|
+
if __name__ == '__main__':
|
|
8
|
+
visual_service = VisualService()
|
|
9
|
+
|
|
10
|
+
# call below method if you don't set ak and sk in $HOME/.volc/config
|
|
11
|
+
visual_service.set_ak('AK')
|
|
12
|
+
visual_service.set_sk('SK')
|
|
13
|
+
|
|
14
|
+
form = {
|
|
15
|
+
"req_key": "xxx",
|
|
16
|
+
"task_id": "xxx",
|
|
17
|
+
"req_json": "{\"logo_info\":{\"add_logo\":true,\"position\":1, \"language\":1,\"opacity\":0.5}}"
|
|
18
|
+
}
|
|
19
|
+
resp = visual_service.cv_sync2async_get_result(form)
|
|
20
|
+
print(resp)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
from __future__ import print_function
|
|
3
|
+
|
|
4
|
+
from byteplus_sdk import visual
|
|
5
|
+
from byteplus_sdk.visual.VisualService import VisualService
|
|
6
|
+
|
|
7
|
+
if __name__ == '__main__':
|
|
8
|
+
visual_service = VisualService()
|
|
9
|
+
|
|
10
|
+
# call below method if you don't set ak and sk in $HOME/.volc/config
|
|
11
|
+
visual_service.set_ak('AK')
|
|
12
|
+
visual_service.set_sk('SK')
|
|
13
|
+
|
|
14
|
+
form = {
|
|
15
|
+
"req_key": "xxx",
|
|
16
|
+
# ...
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
resp = visual_service.cv_sync2async_submit_task(form)
|
|
20
|
+
print(resp)
|
|
@@ -25,8 +25,8 @@ class VisualService(Service):
|
|
|
25
25
|
|
|
26
26
|
@staticmethod
|
|
27
27
|
def get_service_info():
|
|
28
|
-
service_info = ServiceInfo("
|
|
29
|
-
Credentials('', '', 'cv', 'ap-singapore-1'),
|
|
28
|
+
service_info = ServiceInfo("cv.byteplusapi.com", {'Accept': 'application/json'},
|
|
29
|
+
Credentials('', '', 'cv', 'ap-singapore-1'), 30, 30, "https")
|
|
30
30
|
return service_info
|
|
31
31
|
|
|
32
32
|
@staticmethod
|
|
@@ -34,6 +34,11 @@ class VisualService(Service):
|
|
|
34
34
|
api_info = {
|
|
35
35
|
"ComicPortrait": ApiInfo("POST", "/", {"Action": "ComicPortrait", "Version": "2022-08-24"}, {}, {}),
|
|
36
36
|
"PortraitFusion": ApiInfo("POST", "/", {"Action": "PortraitFusion", "Version": "2022-08-24"}, {}, {}),
|
|
37
|
+
"CVProcess": ApiInfo("POST", "/", {"Action": "CVProcess", "Version": "2024-06-06"}, {}, {}),
|
|
38
|
+
"CVSubmitTask": ApiInfo("POST", "/", {"Action": "CVSubmitTask", "Version": "2024-06-06"}, {}, {}),
|
|
39
|
+
"CVGetResult": ApiInfo("POST", "/", {"Action": "CVGetResult", "Version": "2024-06-06"}, {}, {}),
|
|
40
|
+
"CVSync2AsyncSubmitTask": ApiInfo("POST", "/",{"Action": "CVSync2AsyncSubmitTask", "Version": "2024-06-06"}, {}, {}),
|
|
41
|
+
"CVSync2AsyncGetResult": ApiInfo("POST", "/", {"Action": "CVSync2AsyncGetResult", "Version": "2024-06-06"},{}, {}),
|
|
37
42
|
}
|
|
38
43
|
return api_info
|
|
39
44
|
|
|
@@ -64,6 +69,56 @@ class VisualService(Service):
|
|
|
64
69
|
except:
|
|
65
70
|
raise Exception(str(e))
|
|
66
71
|
|
|
72
|
+
def common_json_handler(self, api, body):
|
|
73
|
+
params = dict()
|
|
74
|
+
try:
|
|
75
|
+
res = self.json(api, params, body)
|
|
76
|
+
res_json = json.loads(res)
|
|
77
|
+
|
|
78
|
+
return res_json
|
|
79
|
+
except Exception as e:
|
|
80
|
+
res = str(e)
|
|
81
|
+
try:
|
|
82
|
+
res_json = json.loads(res)
|
|
83
|
+
return res_json
|
|
84
|
+
except:
|
|
85
|
+
raise Exception(str(e))
|
|
86
|
+
|
|
87
|
+
def cv_process(self, body):
|
|
88
|
+
try:
|
|
89
|
+
res_json = self.common_json_handler("CVProcess", body)
|
|
90
|
+
return res_json
|
|
91
|
+
except Exception as e:
|
|
92
|
+
raise Exception(str(e))
|
|
93
|
+
|
|
94
|
+
def cv_submit_task(self, body):
|
|
95
|
+
try:
|
|
96
|
+
res_json = self.common_json_handler("CVSubmitTask", body)
|
|
97
|
+
return res_json
|
|
98
|
+
except Exception as e:
|
|
99
|
+
raise Exception(str(e))
|
|
100
|
+
|
|
101
|
+
def cv_get_result(self, body):
|
|
102
|
+
try:
|
|
103
|
+
res_json = self.common_json_handler("CVGetResult", body)
|
|
104
|
+
return res_json
|
|
105
|
+
except Exception as e:
|
|
106
|
+
raise Exception(str(e))
|
|
107
|
+
|
|
108
|
+
def cv_sync2async_submit_task(self, body):
|
|
109
|
+
try:
|
|
110
|
+
res_json = self.common_json_handler("CVSync2AsyncSubmitTask", body)
|
|
111
|
+
return res_json
|
|
112
|
+
except Exception as e:
|
|
113
|
+
raise Exception(str(e))
|
|
114
|
+
|
|
115
|
+
def cv_sync2async_get_result(self, body):
|
|
116
|
+
try:
|
|
117
|
+
res_json = self.common_json_handler("CVSync2AsyncGetResult", body)
|
|
118
|
+
return res_json
|
|
119
|
+
except Exception as e:
|
|
120
|
+
raise Exception(str(e))
|
|
121
|
+
|
|
67
122
|
def comic_portrait(self, form):
|
|
68
123
|
try:
|
|
69
124
|
res_json = self.common_handler("ComicPortrait", form)
|