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.
Files changed (141) hide show
  1. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/PKG-INFO +1 -1
  2. byteplus-sdk-1.0.49/byteplus_sdk/__init__.py +2 -0
  3. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/cdn/service.py +52 -0
  4. byteplus-sdk-1.0.49/byteplus_sdk/example/cdn/create_rule_engine_template.py +160 -0
  5. byteplus-sdk-1.0.49/byteplus_sdk/example/cdn/describe_rule_engine_template.py +23 -0
  6. byteplus-sdk-1.0.49/byteplus_sdk/example/cdn/release_template.py +23 -0
  7. byteplus-sdk-1.0.49/byteplus_sdk/example/cdn/update_rule_engine_template.py +61 -0
  8. byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_get_result.py +19 -0
  9. byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_process.py +20 -0
  10. byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_submit_task.py +19 -0
  11. byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_sync2async_get_result.py +20 -0
  12. byteplus-sdk-1.0.49/byteplus_sdk/example/visual/cv_sync2async_submit_task.py +20 -0
  13. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/visual/VisualService.py +57 -2
  14. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/VodService.py +158 -0
  15. byteplus-sdk-1.0.49/byteplus_sdk/vod/VodServiceConfig.py +130 -0
  16. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_apps_manage_pb2.py +2 -2
  17. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_cdn_pb2.py +67 -47
  18. byteplus-sdk-1.0.49/byteplus_sdk/vod/models/business/vod_common_pb2.py +322 -0
  19. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_media_pb2.py +143 -93
  20. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_play_pb2.py +11 -1
  21. byteplus-sdk-1.0.49/byteplus_sdk/vod/models/business/vod_project_pb2.py +45 -0
  22. byteplus-sdk-1.0.49/byteplus_sdk/vod/models/business/vod_quality_platform_pb2.py +46 -0
  23. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/request/request_vod_pb2.py +330 -219
  24. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/response/response_vod_pb2.py +313 -211
  25. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/PKG-INFO +1 -1
  26. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/SOURCES.txt +11 -0
  27. byteplus-sdk-1.0.39/byteplus_sdk/__init__.py +0 -2
  28. byteplus-sdk-1.0.39/byteplus_sdk/vod/VodServiceConfig.py +0 -118
  29. byteplus-sdk-1.0.39/byteplus_sdk/vod/models/business/vod_common_pb2.py +0 -255
  30. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/LICENSE +0 -0
  31. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/README.md +0 -0
  32. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/ApiInfo.py +0 -0
  33. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/Credentials.py +0 -0
  34. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/Policy.py +0 -0
  35. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/ServiceInfo.py +0 -0
  36. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/ServiceInfoHttps.py +0 -0
  37. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/auth/MetaData.py +0 -0
  38. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/auth/SignerV4.py +0 -0
  39. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/auth/__init__.py +0 -0
  40. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/Request.py +0 -0
  41. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/Service.py +0 -0
  42. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/__init__.py +0 -0
  43. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/models/__init__.py +0 -0
  44. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/models/base/__init__.py +0 -0
  45. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/base/models/base/base_pb2.py +0 -0
  46. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/cdn/__init__.py +0 -0
  47. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/const/Const.py +0 -0
  48. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/const/__init__.py +0 -0
  49. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/__init__.py +0 -0
  50. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/__init__.py +0 -0
  51. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/add_cdn_certificate.py +0 -0
  52. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/add_cdn_domain.py +0 -0
  53. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/add_template_domain.py +0 -0
  54. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/create_cipher_template.py +0 -0
  55. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/create_service_template.py +0 -0
  56. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/delete_cdn_domain.py +0 -0
  57. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/delete_template.py +0 -0
  58. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_accounting_data.py +0 -0
  59. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_access_log.py +0 -0
  60. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_config.py +0 -0
  61. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_data.py +0 -0
  62. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_data_detail.py +0 -0
  63. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_detail.py +0 -0
  64. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_origin_data.py +0 -0
  65. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_region_and_isp.py +0 -0
  66. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_service.py +0 -0
  67. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cdn_upper_ip.py +0 -0
  68. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_cipher_template.py +0 -0
  69. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_content_block_tasks.py +0 -0
  70. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_content_quota.py +0 -0
  71. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_content_tasks.py +0 -0
  72. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_nrt_data_summary.py +0 -0
  73. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_statistical_data.py +0 -0
  74. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_top_nrt_data.py +0 -0
  75. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_top_statistical_data.py +0 -0
  76. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_edge_top_status_code.py +0 -0
  77. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_ip_info.py +0 -0
  78. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_ip_list_info.py +0 -0
  79. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_origin_nrt_data_summary.py +0 -0
  80. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_origin_top_nrt_data.py +0 -0
  81. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_origin_top_status_code.py +0 -0
  82. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_service_template.py +0 -0
  83. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_template_domains.py +0 -0
  84. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/describe_templates.py +0 -0
  85. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/duplicate_template.py +0 -0
  86. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/list_cdn_cert_info.py +0 -0
  87. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/list_cdn_domains.py +0 -0
  88. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/list_cert_info.py +0 -0
  89. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/lock_template.py +0 -0
  90. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/start_cdn_domain.py +0 -0
  91. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/stop_cdn_domain.py +0 -0
  92. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/submit_block_task.py +0 -0
  93. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/submit_preload_task.py +0 -0
  94. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/submit_refresh_task.py +0 -0
  95. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/submit_unblock_task.py +0 -0
  96. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/update_cdn_config.py +0 -0
  97. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/update_cipher_template.py +0 -0
  98. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/update_service_template.py +0 -0
  99. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/cdn/update_template_domain.py +0 -0
  100. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/live/__init__.py +0 -0
  101. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/rtc/RtcService.py +0 -0
  102. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/rtc/__init__.py +0 -0
  103. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/rtc/example_get_record_task.py +0 -0
  104. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/rtc/example_start_record.py +0 -0
  105. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/visual/__init__.py +0 -0
  106. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/example/visual/example_common.py +0 -0
  107. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/iam/IamService.py +0 -0
  108. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/iam/__init__.py +0 -0
  109. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/LiveService.py +0 -0
  110. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/__init__.py +0 -0
  111. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20200801/__init__.py +0 -0
  112. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20200801/live_config.py +0 -0
  113. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20200801/live_service.py +0 -0
  114. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20200801/live_trait.py +0 -0
  115. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20230101/__init__.py +0 -0
  116. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20230101/live_config.py +0 -0
  117. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20230101/live_service.py +0 -0
  118. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/live/v20230101/live_trait.py +0 -0
  119. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/sms/SmsService.py +0 -0
  120. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/sms/__init__.py +0 -0
  121. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/util/Functions.py +0 -0
  122. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/util/Util.py +0 -0
  123. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/util/__init__.py +0 -0
  124. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/visual/__init__.py +0 -0
  125. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/__init__.py +0 -0
  126. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/__init__.py +0 -0
  127. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/__init__.py +0 -0
  128. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_callback_pb2.py +0 -0
  129. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_edit_pb2.py +0 -0
  130. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_measure_pb2.py +0 -0
  131. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_smart_strategy_pb2.py +0 -0
  132. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_space_pb2.py +0 -0
  133. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_upload_pb2.py +0 -0
  134. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/business/vod_workflow_pb2.py +0 -0
  135. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/request/__init__.py +0 -0
  136. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk/vod/models/response/__init__.py +0 -0
  137. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/dependency_links.txt +0 -0
  138. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/requires.txt +0 -0
  139. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/byteplus_sdk.egg-info/top_level.txt +0 -0
  140. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/setup.cfg +0 -0
  141. {byteplus-sdk-1.0.39 → byteplus-sdk-1.0.49}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byteplus-sdk
3
- Version: 1.0.39
3
+ Version: 1.0.49
4
4
  Summary: The BytePlus SDK for Python
5
5
  Home-page: https://github.com/byteplus-sdk/byteplus-sdk-python
6
6
  Author: BytePlus SDK
@@ -0,0 +1,2 @@
1
+ # coding:utf-8
2
+ VERSION = 'v1.0.49'
@@ -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("open.byteplusapi.com", {'Accept': 'application/json'},
29
- Credentials('', '', 'cv', 'ap-singapore-1'), 10, 30)
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)