byteplus-sdk 1.0.62__py3-none-any.whl

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 (134) hide show
  1. byteplus_sdk/ApiInfo.py +13 -0
  2. byteplus_sdk/Credentials.py +15 -0
  3. byteplus_sdk/Policy.py +91 -0
  4. byteplus_sdk/ServiceInfo.py +11 -0
  5. byteplus_sdk/ServiceInfoHttps.py +11 -0
  6. byteplus_sdk/__init__.py +2 -0
  7. byteplus_sdk/auth/MetaData.py +29 -0
  8. byteplus_sdk/auth/SignerV4.py +145 -0
  9. byteplus_sdk/auth/__init__.py +0 -0
  10. byteplus_sdk/base/Request.py +51 -0
  11. byteplus_sdk/base/Service.py +227 -0
  12. byteplus_sdk/base/__init__.py +0 -0
  13. byteplus_sdk/base/models/__init__.py +0 -0
  14. byteplus_sdk/base/models/base/__init__.py +0 -0
  15. byteplus_sdk/base/models/base/base_pb2.py +46 -0
  16. byteplus_sdk/cdn/__init__.py +0 -0
  17. byteplus_sdk/cdn/service.py +1203 -0
  18. byteplus_sdk/const/Const.py +66 -0
  19. byteplus_sdk/const/__init__.py +0 -0
  20. byteplus_sdk/example/__init__.py +1 -0
  21. byteplus_sdk/example/cdn/__init__.py +3 -0
  22. byteplus_sdk/example/cdn/add_cdn_certificate.py +27 -0
  23. byteplus_sdk/example/cdn/add_cdn_domain.py +35 -0
  24. byteplus_sdk/example/cdn/add_template_domain.py +26 -0
  25. byteplus_sdk/example/cdn/create_cipher_template.py +25 -0
  26. byteplus_sdk/example/cdn/create_rule_engine_template.py +161 -0
  27. byteplus_sdk/example/cdn/create_service_template.py +41 -0
  28. byteplus_sdk/example/cdn/delete_cdn_domain.py +19 -0
  29. byteplus_sdk/example/cdn/delete_template.py +20 -0
  30. byteplus_sdk/example/cdn/describe_accounting_data.py +24 -0
  31. byteplus_sdk/example/cdn/describe_cdn_access_log.py +23 -0
  32. byteplus_sdk/example/cdn/describe_cdn_config.py +19 -0
  33. byteplus_sdk/example/cdn/describe_cdn_data.py +29 -0
  34. byteplus_sdk/example/cdn/describe_cdn_data_detail.py +25 -0
  35. byteplus_sdk/example/cdn/describe_cdn_detail.py +26 -0
  36. byteplus_sdk/example/cdn/describe_cdn_origin_data.py +24 -0
  37. byteplus_sdk/example/cdn/describe_cdn_region_and_isp.py +19 -0
  38. byteplus_sdk/example/cdn/describe_cdn_service.py +15 -0
  39. byteplus_sdk/example/cdn/describe_cdn_upper_ip.py +19 -0
  40. byteplus_sdk/example/cdn/describe_cipher_template.py +20 -0
  41. byteplus_sdk/example/cdn/describe_content_block_tasks.py +23 -0
  42. byteplus_sdk/example/cdn/describe_content_quota.py +14 -0
  43. byteplus_sdk/example/cdn/describe_content_tasks.py +21 -0
  44. byteplus_sdk/example/cdn/describe_edge_nrt_data_summary.py +23 -0
  45. byteplus_sdk/example/cdn/describe_edge_statistical_data.py +24 -0
  46. byteplus_sdk/example/cdn/describe_edge_top_nrt_data.py +25 -0
  47. byteplus_sdk/example/cdn/describe_edge_top_statistical_data.py +25 -0
  48. byteplus_sdk/example/cdn/describe_edge_top_status_code.py +22 -0
  49. byteplus_sdk/example/cdn/describe_ip_info.py +19 -0
  50. byteplus_sdk/example/cdn/describe_ip_list_info.py +20 -0
  51. byteplus_sdk/example/cdn/describe_origin_nrt_data_summary.py +23 -0
  52. byteplus_sdk/example/cdn/describe_origin_top_nrt_data.py +24 -0
  53. byteplus_sdk/example/cdn/describe_origin_top_status_code.py +22 -0
  54. byteplus_sdk/example/cdn/describe_rule_engine_template.py +23 -0
  55. byteplus_sdk/example/cdn/describe_service_template.py +20 -0
  56. byteplus_sdk/example/cdn/describe_template_domains.py +22 -0
  57. byteplus_sdk/example/cdn/describe_templates.py +30 -0
  58. byteplus_sdk/example/cdn/duplicate_template.py +23 -0
  59. byteplus_sdk/example/cdn/list_cdn_cert_info.py +19 -0
  60. byteplus_sdk/example/cdn/list_cdn_domains.py +19 -0
  61. byteplus_sdk/example/cdn/list_cert_info.py +20 -0
  62. byteplus_sdk/example/cdn/lock_template.py +20 -0
  63. byteplus_sdk/example/cdn/release_template.py +23 -0
  64. byteplus_sdk/example/cdn/start_cdn_domain.py +19 -0
  65. byteplus_sdk/example/cdn/stop_cdn_domain.py +19 -0
  66. byteplus_sdk/example/cdn/submit_block_task.py +18 -0
  67. byteplus_sdk/example/cdn/submit_preload_task.py +18 -0
  68. byteplus_sdk/example/cdn/submit_refresh_task.py +19 -0
  69. byteplus_sdk/example/cdn/submit_unblock_task.py +18 -0
  70. byteplus_sdk/example/cdn/update_cdn_config.py +34 -0
  71. byteplus_sdk/example/cdn/update_cipher_template.py +48 -0
  72. byteplus_sdk/example/cdn/update_rule_engine_template.py +62 -0
  73. byteplus_sdk/example/cdn/update_service_template.py +42 -0
  74. byteplus_sdk/example/cdn/update_template_domain.py +29 -0
  75. byteplus_sdk/example/live/__init__.py +0 -0
  76. byteplus_sdk/example/rtc/RtcService.py +53 -0
  77. byteplus_sdk/example/rtc/__init__.py +0 -0
  78. byteplus_sdk/example/rtc/example_get_record_task.py +25 -0
  79. byteplus_sdk/example/rtc/example_start_record.py +86 -0
  80. byteplus_sdk/example/visual/__init__.py +0 -0
  81. byteplus_sdk/example/visual/cv_cancel_task.py +19 -0
  82. byteplus_sdk/example/visual/cv_get_result.py +19 -0
  83. byteplus_sdk/example/visual/cv_process.py +20 -0
  84. byteplus_sdk/example/visual/cv_submit_task.py +19 -0
  85. byteplus_sdk/example/visual/cv_sync2async_get_result.py +20 -0
  86. byteplus_sdk/example/visual/cv_sync2async_submit_task.py +20 -0
  87. byteplus_sdk/example/visual/example_common.py +32 -0
  88. byteplus_sdk/iam/IamService.py +42 -0
  89. byteplus_sdk/iam/__init__.py +0 -0
  90. byteplus_sdk/live/LiveService.py +571 -0
  91. byteplus_sdk/live/__init__.py +1 -0
  92. byteplus_sdk/live/v20200801/__init__.py +1 -0
  93. byteplus_sdk/live/v20200801/live_config.py +18 -0
  94. byteplus_sdk/live/v20200801/live_service.py +12 -0
  95. byteplus_sdk/live/v20200801/live_trait.py +62 -0
  96. byteplus_sdk/live/v20230101/__init__.py +1 -0
  97. byteplus_sdk/live/v20230101/live_config.py +171 -0
  98. byteplus_sdk/live/v20230101/live_service.py +12 -0
  99. byteplus_sdk/live/v20230101/live_trait.py +1133 -0
  100. byteplus_sdk/sms/SmsService.py +158 -0
  101. byteplus_sdk/sms/__init__.py +0 -0
  102. byteplus_sdk/util/Functions.py +37 -0
  103. byteplus_sdk/util/Util.py +116 -0
  104. byteplus_sdk/util/__init__.py +0 -0
  105. byteplus_sdk/visual/VisualService.py +142 -0
  106. byteplus_sdk/visual/__init__.py +0 -0
  107. byteplus_sdk/vod/VodService.py +2941 -0
  108. byteplus_sdk/vod/VodServiceConfig.py +134 -0
  109. byteplus_sdk/vod/__init__.py +0 -0
  110. byteplus_sdk/vod/models/__init__.py +0 -0
  111. byteplus_sdk/vod/models/business/__init__.py +0 -0
  112. byteplus_sdk/vod/models/business/vod_apps_manage_pb2.py +35 -0
  113. byteplus_sdk/vod/models/business/vod_callback_pb2.py +32 -0
  114. byteplus_sdk/vod/models/business/vod_cdn_pb2.py +434 -0
  115. byteplus_sdk/vod/models/business/vod_common_pb2.py +342 -0
  116. byteplus_sdk/vod/models/business/vod_edit_pb2.py +55 -0
  117. byteplus_sdk/vod/models/business/vod_measure_pb2.py +395 -0
  118. byteplus_sdk/vod/models/business/vod_media_pb2.py +547 -0
  119. byteplus_sdk/vod/models/business/vod_play_pb2.py +95 -0
  120. byteplus_sdk/vod/models/business/vod_project_pb2.py +45 -0
  121. byteplus_sdk/vod/models/business/vod_quality_platform_pb2.py +46 -0
  122. byteplus_sdk/vod/models/business/vod_smart_strategy_pb2.py +53 -0
  123. byteplus_sdk/vod/models/business/vod_space_pb2.py +63 -0
  124. byteplus_sdk/vod/models/business/vod_upload_pb2.py +344 -0
  125. byteplus_sdk/vod/models/business/vod_workflow_pb2.py +389 -0
  126. byteplus_sdk/vod/models/request/__init__.py +0 -0
  127. byteplus_sdk/vod/models/request/request_vod_pb2.py +1250 -0
  128. byteplus_sdk/vod/models/response/__init__.py +0 -0
  129. byteplus_sdk/vod/models/response/response_vod_pb2.py +1199 -0
  130. byteplus_sdk-1.0.62.dist-info/METADATA +24 -0
  131. byteplus_sdk-1.0.62.dist-info/RECORD +134 -0
  132. byteplus_sdk-1.0.62.dist-info/WHEEL +5 -0
  133. byteplus_sdk-1.0.62.dist-info/licenses/LICENSE +201 -0
  134. byteplus_sdk-1.0.62.dist-info/top_level.txt +1 -0
@@ -0,0 +1,66 @@
1
+ # coding: utf-8
2
+
3
+ REGION_CN_NORTH1 = "cn-north-1"
4
+ REGION_US_EAST1 = "us-east-1"
5
+ REGION_AP_SINGAPORE1 = "ap-singapore-1"
6
+
7
+ INNER_REGION_CN_NORTH1 = "cn-north-1-inner"
8
+ INNER_REGION_US_EAST1 = "us-east-1-inner"
9
+ INNER_REGION_AP_SINGAPORE1 = "ap-singapore-1-inner"
10
+
11
+ HTTP = 'http'
12
+ HTTPS = 'https'
13
+
14
+ FILE_TYPE_VIDEO = 'video'
15
+ FILE_TYPE_MEDIA = 'media'
16
+ FILE_TYPE_IMAGE = 'image'
17
+ FILE_TYPE_OBJECT = 'object'
18
+
19
+ UPLOAD_FORMAT_MP4 = 'mp4'
20
+ UPLOAD_FORMAT_M3U8 = 'm3u8'
21
+
22
+ FORMAT_JPEG = 'jpeg'
23
+ FORMAT_PNG = 'png'
24
+ FORMAT_WEBP = 'webp'
25
+ FORMAT_AWEBP = 'awebp'
26
+ FORMAT_GIF = 'gif'
27
+ FORMAT_HEIC = 'heic'
28
+ FORMAT_ORIGINAL = 'image'
29
+
30
+ VOD_TPL_OBJ = 'tplv-vod-obj'
31
+ VOD_TPL_NOOP = 'tplv-vod-noop'
32
+ VOD_TPL_RESIZE = 'tplv-vod-rs'
33
+ VOD_TPL_CENTER_CROP = 'tplv-vod-cc'
34
+ VOD_TPL_SMART_CROP = 'tplv-vod-cs'
35
+ VOD_TPL_SIG = 'tplv-bd-sig'
36
+
37
+ LETTER_RUNES = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
38
+
39
+ RESOURCE_SPACE_FORMAT = "trn:vod:%s:*:space/%s"
40
+ RESOURCE_VIDEO_FORMAT = 'trn:vod::*:video_id/%s'
41
+ RESOURCE_STREAM_TYPE_FORMAT = 'trn:vod:::stream_type/%s'
42
+ RESOURCE_WATERMARK_FORMAT = 'trn:vod::*:watermark/%s'
43
+
44
+ ACTION_VOD_GET_PLAY_INFO = "vod:GetPlayInfo"
45
+
46
+ STAR = '*'
47
+
48
+ CATEGORY_VIDEO = "video"
49
+ CATEGORY_AUDIO = "audio"
50
+ CATEGORY_IMAGE = "image"
51
+ CATEGORY_DYNAMICIMG = "dynamic_img"
52
+ CATEGORY_SUBTITLE = "subtitle"
53
+ CATEGORY_FONT = "font"
54
+
55
+ SMS_CHANNEL_TYPE_CN_OTP = "CN_OTP"
56
+ SMS_CHANNEL_TYPE_CN_NTC = "CN_NTC"
57
+ SMS_CHANNEL_TYPE_CN_MKT = "CN_MKT"
58
+ SMS_CHANNEL_TYPE_I18N_OTP = "I18N_OTP"
59
+ SMS_CHANNEL_TYPE_I18N_MKT = "I18N_MKT"
60
+
61
+ ENABLE_STATUS_NOT_ENABLE = "0"
62
+ ENABLE_STATUS_ENABLE = "1"
63
+
64
+ AREA_CN = "cn"
65
+ AREA_OVERSEAS = "overseas"
66
+ AREA_ALL = "all"
File without changes
@@ -0,0 +1 @@
1
+ name = 'byteplus'
@@ -0,0 +1,3 @@
1
+ # coding=utf-8
2
+ ak = ''
3
+ sk = ''
@@ -0,0 +1,27 @@
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
+ if __name__ == '__main__':
11
+ svc = CDNService()
12
+ svc.set_ak(ak)
13
+ svc.set_sk(sk)
14
+
15
+ body = {
16
+ 'Certificate': {
17
+ 'Certificate': '''-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----''',
18
+ 'PrivateKey': '''-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY-----'''
19
+ },
20
+ 'CertInfo': {
21
+ 'Desc': 'remark',
22
+ },
23
+ 'Source': 'volc_cert_center'
24
+ }
25
+
26
+ resp = svc.add_cdn_certificate(body)
27
+ print(resp)
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+
6
+ from byteplus_sdk.example.cdn import ak, sk
7
+ from byteplus_sdk.cdn.service import CDNService
8
+
9
+ if __name__ == '__main__':
10
+ svc = CDNService()
11
+ svc.set_ak(ak)
12
+ svc.set_sk(sk)
13
+
14
+ body = {
15
+ 'Domain': 'example.com',
16
+ 'ServiceType': 'web',
17
+ 'Origin': [
18
+ {
19
+ 'OriginAction': {
20
+ 'OriginLines': [{
21
+ 'OriginType': 'primary',
22
+ 'InstanceType': 'ip',
23
+ 'Address': '1.1.1.1',
24
+ 'HttpPort': '80',
25
+ 'HttpsPort': '443',
26
+ 'Weight': '100'
27
+ }]
28
+ }
29
+ }
30
+ ],
31
+ 'OriginProtocol': 'HTTP'
32
+ }
33
+
34
+ resp = svc.add_cdn_domain(body)
35
+ print(resp)
@@ -0,0 +1,26 @@
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
+ if __name__ == '__main__':
11
+ svc = CDNService()
12
+ svc.set_ak(ak)
13
+ svc.set_sk(sk)
14
+
15
+ body = {
16
+ "ServiceRegion": "global",
17
+ "Project": "default",
18
+ "ServiceTemplateId": "tpl-example",
19
+ "CertId": "cert-example",
20
+ "CipherTemplateId": "tpl-example",
21
+ "Domain": "example.com",
22
+ "HTTPSSwitch": "on"
23
+ }
24
+
25
+ resp = svc.add_template_domain(body)
26
+ print(resp)
@@ -0,0 +1,25 @@
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
+ if __name__ == '__main__':
11
+ svc = CDNService()
12
+ svc.set_ak(ak)
13
+ svc.set_sk(sk)
14
+
15
+ body = {
16
+ "Title": "example",
17
+ "Message": "example",
18
+ "Project": "default",
19
+ "Quic": {
20
+ "Switch": False
21
+ }
22
+ }
23
+
24
+ resp = svc.create_cipher_template(body)
25
+ print(resp)
@@ -0,0 +1,161 @@
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
+ # pip3 install cdn_rule_engine_sdk
11
+ from cdn_rule_engine_sdk.rule_engine.Const import Const
12
+ from cdn_rule_engine_sdk.rule_engine.Rule import Rule, Condition, Action
13
+
14
+ def example():
15
+ cdn_service = CDNService()
16
+ cdn_service.set_ak(ak)
17
+ cdn_service.set_sk(sk)
18
+
19
+ # Create a rule engine policy that sets the cache time to 0 seconds under any conditions.
20
+ rule = Rule()
21
+ rule.desc = "example"
22
+ rule.if_block.condition = Condition({
23
+ "IsGroup": False,
24
+ "Connective": Const.ConnectiveAnd,
25
+ "Condition": {
26
+ "Object": Const.ConditionAlways,
27
+ }
28
+ })
29
+ rule.if_block.actions.append(Action({
30
+ "Action": Const.ActionCacheTime,
31
+ "Groups": [{
32
+ "Dimension": Const.ActionCacheTime,
33
+ "GroupParameters": [{
34
+ "Parameters": [
35
+ {
36
+ "Name": "ttl",
37
+ "Values": ["0"]
38
+ },
39
+ {
40
+ "Name": "ttl_unit",
41
+ "Values": ["sec"]
42
+ },
43
+ {
44
+ "Name": "cache_policy",
45
+ "Values": [Const.CacheDefault]
46
+ },
47
+ {
48
+ "Name": "force_cache",
49
+ "Values": ["true"]
50
+ }
51
+ ]
52
+ }]
53
+ }]
54
+ }))
55
+
56
+ rsp = cdn_service.create_rule_engine_template({
57
+ "Project": "default",
58
+ "Title": "example",
59
+ "Message": "Under any conditions, set the cache time to 0 seconds",
60
+ "Rule": rule.encode_to_string()
61
+ })
62
+ print(rsp)
63
+
64
+ def example2():
65
+ cdn_service = CDNService()
66
+ cdn_service.set_ak(ak)
67
+ cdn_service.set_sk(sk)
68
+
69
+ # When the Referer request header is equal to 'example', set the HTTP response header 'test' with a value of abc123.
70
+ rule = Rule()
71
+ rule.desc = "example"
72
+ rule.if_block.condition = Condition({
73
+ "IsGroup": False,
74
+ "Connective": Const.ConnectiveAnd,
75
+ "Condition": {
76
+ "Object": Const.ConditionHTTPReferer,
77
+ "Operator": Const.OperatorEqual,
78
+ "Value": ["example"],
79
+ "IgnoreCase": True
80
+ }
81
+ })
82
+ rule.if_block.actions.append(Action({
83
+ "Action": Const.ConditionResponseHeader,
84
+ "Groups": [{
85
+ "Dimension": Const.ActionResponseHeader,
86
+ "GroupParameters": [{
87
+ "Parameters": [
88
+ {
89
+ "Name": "action",
90
+ "Values": ["set"]
91
+ },
92
+ {
93
+ "Name": "header_name",
94
+ "Values": ["test"]
95
+ },
96
+ {
97
+ "Name": "header_value",
98
+ "Values": ["abc123"]
99
+ }
100
+ ]
101
+ }]
102
+ }]
103
+ }))
104
+
105
+ rsp = cdn_service.create_rule_engine_template({
106
+ "Project": "default",
107
+ "Title": "example2",
108
+ "Message": "When the Referer request header is equal to 'example', set the HTTP response header 'test' with a value of abc123.",
109
+ "Rule": rule.encode_to_string()
110
+ })
111
+ print(rsp)
112
+
113
+ def example3():
114
+ cdn_service = CDNService()
115
+ cdn_service.set_ak(ak)
116
+ cdn_service.set_sk(sk)
117
+
118
+ # 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
119
+ rule = Rule()
120
+ rule.desc = "example"
121
+ rule.if_block.condition = Condition({
122
+ "IsGroup": False,
123
+ "Connective": Const.ConnectiveAnd,
124
+ "Condition": {
125
+ "Object": Const.ConditionHTTPUrl,
126
+ "Operator": Const.OperatorEqual,
127
+ "Value": ["http://www.test.com/path1?a=1"],
128
+ "IgnoreCase": True
129
+ }
130
+ })
131
+ rule.if_block.actions.append(Action({
132
+ "Action": Const.ActionRedirectProtocol,
133
+ "Groups": [{
134
+ "Dimension": Const.ActionRedirectProtocol,
135
+ "GroupParameters": [{
136
+ "Parameters": [
137
+ {
138
+ "Name": "status_code",
139
+ "Values": ["301"]
140
+ },
141
+ {
142
+ "Name": "protocol",
143
+ "Values": ["https"]
144
+ }
145
+ ]
146
+ }]
147
+ }]
148
+ }))
149
+
150
+ rsp = cdn_service.create_rule_engine_template({
151
+ "Project": "default",
152
+ "Title": "example3",
153
+ "Message": "",
154
+ "Rule": rule.encode_to_string()
155
+ })
156
+ print(rsp)
157
+
158
+ if __name__ == '__main__':
159
+ example1()
160
+ example2()
161
+ example3()
@@ -0,0 +1,41 @@
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
+ if __name__ == '__main__':
11
+ svc = CDNService()
12
+ svc.set_ak(ak)
13
+ svc.set_sk(sk)
14
+
15
+ body = {
16
+ "Title": "example",
17
+ "Message": "example",
18
+ "Project": "default",
19
+ "OriginProtocol": "http",
20
+ "OriginHost": "",
21
+ "Origin": [
22
+ {
23
+ "OriginAction": {
24
+ "OriginLines": [
25
+ {
26
+ "OriginType": "primary",
27
+ "InstanceType": "domain",
28
+ "Address": "example.com",
29
+ "Weight": "1",
30
+ "HttpPort": "80",
31
+ "HttpsPort": "443",
32
+ "OriginHost": ""
33
+ }
34
+ ]
35
+ }
36
+ }
37
+ ]
38
+ }
39
+
40
+ resp = svc.create_service_template(body)
41
+ print(resp)
@@ -0,0 +1,19 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+
6
+ from byteplus_sdk.example.cdn import ak, sk
7
+ from byteplus_sdk.cdn.service import CDNService
8
+
9
+ if __name__ == '__main__':
10
+ svc = CDNService()
11
+ svc.set_ak(ak)
12
+ svc.set_sk(sk)
13
+
14
+ body = {
15
+ 'Domain': 'example.com',
16
+ }
17
+
18
+ resp = svc.delete_cdn_domain(body)
19
+ print(resp)
@@ -0,0 +1,20 @@
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
+ if __name__ == '__main__':
11
+ svc = CDNService()
12
+ svc.set_ak(ak)
13
+ svc.set_sk(sk)
14
+
15
+ body = {
16
+ "TemplateId": "tpl-example"
17
+ }
18
+
19
+ resp = svc.delete_template(body)
20
+ print(resp)
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+
6
+ import datetime
7
+
8
+ from byteplus_sdk.example.cdn import ak, sk
9
+ from byteplus_sdk.cdn.service import CDNService
10
+
11
+ if __name__ == '__main__':
12
+ svc = CDNService()
13
+ svc.set_ak(ak)
14
+ svc.set_sk(sk)
15
+ now = int(datetime.datetime.now().strftime("%s"))
16
+ body = {
17
+ 'StartTime': now - 3600,
18
+ 'EndTime': now,
19
+ 'Metric': 'flux',
20
+ 'Domain': 'example.com',
21
+ }
22
+
23
+ resp = svc.describe_accounting_data(body)
24
+ print(resp)
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+
6
+ import datetime
7
+
8
+ from byteplus_sdk.example.cdn import ak, sk
9
+ from byteplus_sdk.cdn.service import CDNService
10
+
11
+ if __name__ == '__main__':
12
+ svc = CDNService()
13
+ svc.set_ak(ak)
14
+ svc.set_sk(sk)
15
+ now = int(datetime.datetime.now().strftime("%s"))
16
+ body = {
17
+ 'StartTime': now - 3600,
18
+ 'EndTime': now,
19
+ 'Domain': 'example.com',
20
+ }
21
+
22
+ resp = svc.describe_cdn_access_log(body)
23
+ print(resp)
@@ -0,0 +1,19 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+
6
+ from byteplus_sdk.example.cdn import ak, sk
7
+ from byteplus_sdk.cdn.service import CDNService
8
+
9
+ if __name__ == '__main__':
10
+ svc = CDNService()
11
+ svc.set_ak(ak)
12
+ svc.set_sk(sk)
13
+
14
+ body = {
15
+ 'Domain': 'example.com'
16
+ }
17
+
18
+ resp = svc.describe_cdn_config(body)
19
+ print(resp)
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+ import datetime
6
+
7
+ from byteplus_sdk.example.cdn import ak, sk
8
+ from byteplus_sdk.cdn.service import CDNService
9
+
10
+ if __name__ == '__main__':
11
+ svc = CDNService()
12
+ svc.set_ak(ak)
13
+ svc.set_sk(sk)
14
+ now = int(datetime.datetime.now().strftime("%s"))
15
+ body = {
16
+ 'StartTime': now - 86400,
17
+ 'EndTime': now,
18
+ 'Metric': 'pv',
19
+ 'Domain': 'example.com',
20
+ 'Interval': '5min',
21
+ 'Isp': 'CT',
22
+ 'Region': 'BJ',
23
+ 'Protocol': 'http',
24
+ 'IpVersion': 'ipv4',
25
+ "OnlyTotal": True
26
+ }
27
+
28
+ resp = svc.describe_cdn_data(body)
29
+ print(resp)
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ import os
3
+ import sys
4
+ import datetime
5
+
6
+ sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../../")
7
+
8
+ from byteplus_sdk.example.cdn import ak, sk
9
+ from byteplus_sdk.cdn.service import CDNService
10
+
11
+ if __name__ == '__main__':
12
+ svc = CDNService()
13
+ svc.set_ak(ak)
14
+ svc.set_sk(sk)
15
+
16
+ now = int(datetime.datetime.now().strftime("%s"))
17
+ body = {
18
+ 'StartTime': now - 600,
19
+ 'EndTime': now,
20
+ 'Metric': 'flux',
21
+ 'Domain': 'example.com',
22
+ }
23
+
24
+ resp = svc.describe_cdn_data_detail(body)
25
+ print(resp)
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+ import datetime
6
+
7
+ from byteplus_sdk.example.cdn import ak, sk
8
+ from byteplus_sdk.cdn.service import CDNService
9
+
10
+ if __name__ == '__main__':
11
+ svc = CDNService()
12
+ svc.set_ak(ak)
13
+ svc.set_sk(sk)
14
+ now = int(datetime.datetime.now().strftime("%s"))
15
+ body = {
16
+ 'StartTime': now - 3600,
17
+ 'EndTime': now,
18
+ 'Metric': 'pv',
19
+ 'Domain': 'example.com',
20
+ 'Interval': '5min',
21
+ 'Protocol': 'http',
22
+ 'IpVersion': 'ipv4'
23
+ }
24
+
25
+ resp = svc.describe_cdn_data_detail(body)
26
+ print(resp)
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+ import datetime
6
+
7
+ from byteplus_sdk.example.cdn import ak, sk
8
+ from byteplus_sdk.cdn.service import CDNService
9
+
10
+ if __name__ == '__main__':
11
+ svc = CDNService()
12
+ svc.set_ak(ak)
13
+ svc.set_sk(sk)
14
+ now = int(datetime.datetime.now().strftime("%s"))
15
+ body = {
16
+ 'StartTime': now - 3600,
17
+ 'EndTime': now,
18
+ 'Metric': 'pv',
19
+ 'Domain': 'example.com',
20
+ 'Interval': '5min',
21
+ }
22
+
23
+ resp = svc.describe_cdn_origin_data(body)
24
+ print(resp)
@@ -0,0 +1,19 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+
6
+ from byteplus_sdk.example.cdn import ak, sk
7
+ from byteplus_sdk.cdn.service import CDNService
8
+
9
+ if __name__ == '__main__':
10
+ svc = CDNService()
11
+ svc.set_ak(ak)
12
+ svc.set_sk(sk)
13
+ body = {
14
+ 'Area': 'China'
15
+ }
16
+ print(body)
17
+
18
+ resp = svc.describe_cdn_region_and_isp(body)
19
+ print(resp)
@@ -0,0 +1,15 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+
6
+ from byteplus_sdk.example.cdn import ak, sk
7
+ from byteplus_sdk.cdn.service import CDNService
8
+
9
+ if __name__ == '__main__':
10
+ svc = CDNService()
11
+ svc.set_ak(ak)
12
+ svc.set_sk(sk)
13
+
14
+ resp = svc.describe_cdn_service()
15
+ print(resp)
@@ -0,0 +1,19 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import os
4
+ sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../../")
5
+
6
+ from byteplus_sdk.example.cdn import ak, sk
7
+ from byteplus_sdk.cdn.service import CDNService
8
+
9
+ if __name__ == '__main__':
10
+ svc = CDNService()
11
+ svc.set_ak(ak)
12
+ svc.set_sk(sk)
13
+
14
+ body = {
15
+ 'Domain': 'example.com',
16
+ }
17
+
18
+ resp = svc.describe_cdn_upper_ip(body)
19
+ print(resp)