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.
- byteplus_sdk/ApiInfo.py +13 -0
- byteplus_sdk/Credentials.py +15 -0
- byteplus_sdk/Policy.py +91 -0
- byteplus_sdk/ServiceInfo.py +11 -0
- byteplus_sdk/ServiceInfoHttps.py +11 -0
- byteplus_sdk/__init__.py +2 -0
- byteplus_sdk/auth/MetaData.py +29 -0
- byteplus_sdk/auth/SignerV4.py +145 -0
- byteplus_sdk/auth/__init__.py +0 -0
- byteplus_sdk/base/Request.py +51 -0
- byteplus_sdk/base/Service.py +227 -0
- byteplus_sdk/base/__init__.py +0 -0
- byteplus_sdk/base/models/__init__.py +0 -0
- byteplus_sdk/base/models/base/__init__.py +0 -0
- byteplus_sdk/base/models/base/base_pb2.py +46 -0
- byteplus_sdk/cdn/__init__.py +0 -0
- byteplus_sdk/cdn/service.py +1203 -0
- byteplus_sdk/const/Const.py +66 -0
- byteplus_sdk/const/__init__.py +0 -0
- byteplus_sdk/example/__init__.py +1 -0
- byteplus_sdk/example/cdn/__init__.py +3 -0
- byteplus_sdk/example/cdn/add_cdn_certificate.py +27 -0
- byteplus_sdk/example/cdn/add_cdn_domain.py +35 -0
- byteplus_sdk/example/cdn/add_template_domain.py +26 -0
- byteplus_sdk/example/cdn/create_cipher_template.py +25 -0
- byteplus_sdk/example/cdn/create_rule_engine_template.py +161 -0
- byteplus_sdk/example/cdn/create_service_template.py +41 -0
- byteplus_sdk/example/cdn/delete_cdn_domain.py +19 -0
- byteplus_sdk/example/cdn/delete_template.py +20 -0
- byteplus_sdk/example/cdn/describe_accounting_data.py +24 -0
- byteplus_sdk/example/cdn/describe_cdn_access_log.py +23 -0
- byteplus_sdk/example/cdn/describe_cdn_config.py +19 -0
- byteplus_sdk/example/cdn/describe_cdn_data.py +29 -0
- byteplus_sdk/example/cdn/describe_cdn_data_detail.py +25 -0
- byteplus_sdk/example/cdn/describe_cdn_detail.py +26 -0
- byteplus_sdk/example/cdn/describe_cdn_origin_data.py +24 -0
- byteplus_sdk/example/cdn/describe_cdn_region_and_isp.py +19 -0
- byteplus_sdk/example/cdn/describe_cdn_service.py +15 -0
- byteplus_sdk/example/cdn/describe_cdn_upper_ip.py +19 -0
- byteplus_sdk/example/cdn/describe_cipher_template.py +20 -0
- byteplus_sdk/example/cdn/describe_content_block_tasks.py +23 -0
- byteplus_sdk/example/cdn/describe_content_quota.py +14 -0
- byteplus_sdk/example/cdn/describe_content_tasks.py +21 -0
- byteplus_sdk/example/cdn/describe_edge_nrt_data_summary.py +23 -0
- byteplus_sdk/example/cdn/describe_edge_statistical_data.py +24 -0
- byteplus_sdk/example/cdn/describe_edge_top_nrt_data.py +25 -0
- byteplus_sdk/example/cdn/describe_edge_top_statistical_data.py +25 -0
- byteplus_sdk/example/cdn/describe_edge_top_status_code.py +22 -0
- byteplus_sdk/example/cdn/describe_ip_info.py +19 -0
- byteplus_sdk/example/cdn/describe_ip_list_info.py +20 -0
- byteplus_sdk/example/cdn/describe_origin_nrt_data_summary.py +23 -0
- byteplus_sdk/example/cdn/describe_origin_top_nrt_data.py +24 -0
- byteplus_sdk/example/cdn/describe_origin_top_status_code.py +22 -0
- byteplus_sdk/example/cdn/describe_rule_engine_template.py +23 -0
- byteplus_sdk/example/cdn/describe_service_template.py +20 -0
- byteplus_sdk/example/cdn/describe_template_domains.py +22 -0
- byteplus_sdk/example/cdn/describe_templates.py +30 -0
- byteplus_sdk/example/cdn/duplicate_template.py +23 -0
- byteplus_sdk/example/cdn/list_cdn_cert_info.py +19 -0
- byteplus_sdk/example/cdn/list_cdn_domains.py +19 -0
- byteplus_sdk/example/cdn/list_cert_info.py +20 -0
- byteplus_sdk/example/cdn/lock_template.py +20 -0
- byteplus_sdk/example/cdn/release_template.py +23 -0
- byteplus_sdk/example/cdn/start_cdn_domain.py +19 -0
- byteplus_sdk/example/cdn/stop_cdn_domain.py +19 -0
- byteplus_sdk/example/cdn/submit_block_task.py +18 -0
- byteplus_sdk/example/cdn/submit_preload_task.py +18 -0
- byteplus_sdk/example/cdn/submit_refresh_task.py +19 -0
- byteplus_sdk/example/cdn/submit_unblock_task.py +18 -0
- byteplus_sdk/example/cdn/update_cdn_config.py +34 -0
- byteplus_sdk/example/cdn/update_cipher_template.py +48 -0
- byteplus_sdk/example/cdn/update_rule_engine_template.py +62 -0
- byteplus_sdk/example/cdn/update_service_template.py +42 -0
- byteplus_sdk/example/cdn/update_template_domain.py +29 -0
- byteplus_sdk/example/live/__init__.py +0 -0
- byteplus_sdk/example/rtc/RtcService.py +53 -0
- byteplus_sdk/example/rtc/__init__.py +0 -0
- byteplus_sdk/example/rtc/example_get_record_task.py +25 -0
- byteplus_sdk/example/rtc/example_start_record.py +86 -0
- byteplus_sdk/example/visual/__init__.py +0 -0
- byteplus_sdk/example/visual/cv_cancel_task.py +19 -0
- byteplus_sdk/example/visual/cv_get_result.py +19 -0
- byteplus_sdk/example/visual/cv_process.py +20 -0
- byteplus_sdk/example/visual/cv_submit_task.py +19 -0
- byteplus_sdk/example/visual/cv_sync2async_get_result.py +20 -0
- byteplus_sdk/example/visual/cv_sync2async_submit_task.py +20 -0
- byteplus_sdk/example/visual/example_common.py +32 -0
- byteplus_sdk/iam/IamService.py +42 -0
- byteplus_sdk/iam/__init__.py +0 -0
- byteplus_sdk/live/LiveService.py +571 -0
- byteplus_sdk/live/__init__.py +1 -0
- byteplus_sdk/live/v20200801/__init__.py +1 -0
- byteplus_sdk/live/v20200801/live_config.py +18 -0
- byteplus_sdk/live/v20200801/live_service.py +12 -0
- byteplus_sdk/live/v20200801/live_trait.py +62 -0
- byteplus_sdk/live/v20230101/__init__.py +1 -0
- byteplus_sdk/live/v20230101/live_config.py +171 -0
- byteplus_sdk/live/v20230101/live_service.py +12 -0
- byteplus_sdk/live/v20230101/live_trait.py +1133 -0
- byteplus_sdk/sms/SmsService.py +158 -0
- byteplus_sdk/sms/__init__.py +0 -0
- byteplus_sdk/util/Functions.py +37 -0
- byteplus_sdk/util/Util.py +116 -0
- byteplus_sdk/util/__init__.py +0 -0
- byteplus_sdk/visual/VisualService.py +142 -0
- byteplus_sdk/visual/__init__.py +0 -0
- byteplus_sdk/vod/VodService.py +2941 -0
- byteplus_sdk/vod/VodServiceConfig.py +134 -0
- byteplus_sdk/vod/__init__.py +0 -0
- byteplus_sdk/vod/models/__init__.py +0 -0
- byteplus_sdk/vod/models/business/__init__.py +0 -0
- byteplus_sdk/vod/models/business/vod_apps_manage_pb2.py +35 -0
- byteplus_sdk/vod/models/business/vod_callback_pb2.py +32 -0
- byteplus_sdk/vod/models/business/vod_cdn_pb2.py +434 -0
- byteplus_sdk/vod/models/business/vod_common_pb2.py +342 -0
- byteplus_sdk/vod/models/business/vod_edit_pb2.py +55 -0
- byteplus_sdk/vod/models/business/vod_measure_pb2.py +395 -0
- byteplus_sdk/vod/models/business/vod_media_pb2.py +547 -0
- byteplus_sdk/vod/models/business/vod_play_pb2.py +95 -0
- byteplus_sdk/vod/models/business/vod_project_pb2.py +45 -0
- byteplus_sdk/vod/models/business/vod_quality_platform_pb2.py +46 -0
- byteplus_sdk/vod/models/business/vod_smart_strategy_pb2.py +53 -0
- byteplus_sdk/vod/models/business/vod_space_pb2.py +63 -0
- byteplus_sdk/vod/models/business/vod_upload_pb2.py +344 -0
- byteplus_sdk/vod/models/business/vod_workflow_pb2.py +389 -0
- byteplus_sdk/vod/models/request/__init__.py +0 -0
- byteplus_sdk/vod/models/request/request_vod_pb2.py +1250 -0
- byteplus_sdk/vod/models/response/__init__.py +0 -0
- byteplus_sdk/vod/models/response/response_vod_pb2.py +1199 -0
- byteplus_sdk-1.0.62.dist-info/METADATA +24 -0
- byteplus_sdk-1.0.62.dist-info/RECORD +134 -0
- byteplus_sdk-1.0.62.dist-info/WHEEL +5 -0
- byteplus_sdk-1.0.62.dist-info/licenses/LICENSE +201 -0
- byteplus_sdk-1.0.62.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
import json
|
|
3
|
+
import threading
|
|
4
|
+
|
|
5
|
+
from byteplus_sdk.ApiInfo import ApiInfo
|
|
6
|
+
from byteplus_sdk.Credentials import Credentials
|
|
7
|
+
from byteplus_sdk.ServiceInfo import ServiceInfo
|
|
8
|
+
from byteplus_sdk.base.Service import Service
|
|
9
|
+
from byteplus_sdk.const.Const import REGION_AP_SINGAPORE1
|
|
10
|
+
|
|
11
|
+
LIVE_SERVICE_VERSION = "2020-08-01"
|
|
12
|
+
service_info_map = {
|
|
13
|
+
REGION_AP_SINGAPORE1: ServiceInfo("open.byteplusapi.com", {'Accept': 'application/json', },
|
|
14
|
+
Credentials('', '', "live", REGION_AP_SINGAPORE1), 5, 5, "https"),
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
api_info = {
|
|
18
|
+
"ListCommonTransPresetDetail": ApiInfo("POST", "/",
|
|
19
|
+
{"Action": "ListCommonTransPresetDetail", "Version": LIVE_SERVICE_VERSION},
|
|
20
|
+
{}, {}),
|
|
21
|
+
"UpdateCallback": ApiInfo("POST", "/", {"Action": "UpdateCallback", "Version": LIVE_SERVICE_VERSION}, {}, {}),
|
|
22
|
+
"DescribeCallback": ApiInfo("POST", "/", {"Action": "DescribeCallback", "Version": LIVE_SERVICE_VERSION}, {},
|
|
23
|
+
{}),
|
|
24
|
+
"DeleteCallback": ApiInfo("POST", "/", {"Action": "DeleteCallback", "Version": LIVE_SERVICE_VERSION},
|
|
25
|
+
{}, {}),
|
|
26
|
+
|
|
27
|
+
"CreateDomain": ApiInfo("POST", "/", {"Action": "CreateDomain", "Version": LIVE_SERVICE_VERSION}, {}, {}),
|
|
28
|
+
|
|
29
|
+
"DeleteDomain": ApiInfo("POST", "/", {"Action": "DeleteDomain", "Version": LIVE_SERVICE_VERSION},
|
|
30
|
+
{},
|
|
31
|
+
{}),
|
|
32
|
+
"ListDomainDetail": ApiInfo("POST", "/",
|
|
33
|
+
{"Action": "ListDomainDetail", "Version": LIVE_SERVICE_VERSION},
|
|
34
|
+
{}, {}),
|
|
35
|
+
"DescribeDomain": ApiInfo("POST", "/",
|
|
36
|
+
{"Action": "DescribeDomain", "Version": LIVE_SERVICE_VERSION},
|
|
37
|
+
{}, {}),
|
|
38
|
+
"EnableDomain": ApiInfo("POST", "/",
|
|
39
|
+
{"Action": "EnableDomain", "Version": LIVE_SERVICE_VERSION},
|
|
40
|
+
{}, {}),
|
|
41
|
+
"DisableDomain": ApiInfo("POST", "/",
|
|
42
|
+
{"Action": "DisableDomain", "Version": LIVE_SERVICE_VERSION},
|
|
43
|
+
{}, {}),
|
|
44
|
+
"ManagerPullPushDomainBind": ApiInfo("POST", "/",
|
|
45
|
+
{"Action": "ManagerPullPushDomainBind", "Version": LIVE_SERVICE_VERSION},
|
|
46
|
+
{},
|
|
47
|
+
{}),
|
|
48
|
+
"UpdateAuthKey": ApiInfo("POST", "/", {"Action": "UpdateAuthKey", "Version": LIVE_SERVICE_VERSION}, {}, {}),
|
|
49
|
+
"DescribeAuth": ApiInfo("POST", "/", {"Action": "DescribeAuth", "Version": LIVE_SERVICE_VERSION}, {}, {}),
|
|
50
|
+
"ForbidStream": ApiInfo("POST", "/", {"Action": "ForbidStream", "Version": LIVE_SERVICE_VERSION}, {},
|
|
51
|
+
{}),
|
|
52
|
+
"ResumeStream": ApiInfo("POST", "/", {"Action": "ResumeStream", "Version": LIVE_SERVICE_VERSION}, {},
|
|
53
|
+
{}),
|
|
54
|
+
"ListCert": ApiInfo("POST", "/", {"Action": "ListCert", "Version": LIVE_SERVICE_VERSION}, {},
|
|
55
|
+
{}),
|
|
56
|
+
"CreateCert": ApiInfo("POST", "/", {"Action": "CreateCert", "Version": LIVE_SERVICE_VERSION}, {},
|
|
57
|
+
{}),
|
|
58
|
+
"UpdateCert": ApiInfo("POST", "/", {"Action": "UpdateCert", "Version": LIVE_SERVICE_VERSION}, {},
|
|
59
|
+
{}),
|
|
60
|
+
"BindCert": ApiInfo("POST", "/", {"Action": "BindCert", "Version": LIVE_SERVICE_VERSION}, {},
|
|
61
|
+
{}),
|
|
62
|
+
"UnbindCert": ApiInfo("POST", "/", {"Action": "UnbindCert", "Version": LIVE_SERVICE_VERSION}, {},
|
|
63
|
+
{}),
|
|
64
|
+
"DeleteCert": ApiInfo("POST", "/", {"Action": "DeleteCert", "Version": LIVE_SERVICE_VERSION}, {},
|
|
65
|
+
{}),
|
|
66
|
+
"UpdateReferer": ApiInfo("POST", "/", {"Action": "UpdateReferer", "Version": LIVE_SERVICE_VERSION}, {},
|
|
67
|
+
{}),
|
|
68
|
+
"DeleteReferer": ApiInfo("POST", "/", {"Action": "DeleteReferer", "Version": LIVE_SERVICE_VERSION}, {},
|
|
69
|
+
{}),
|
|
70
|
+
"DescribeReferer": ApiInfo("POST", "/", {"Action": "DescribeReferer", "Version": LIVE_SERVICE_VERSION}, {},
|
|
71
|
+
{}),
|
|
72
|
+
"CreateRecordPreset": ApiInfo("POST", "/", {"Action": "CreateRecordPreset", "Version": LIVE_SERVICE_VERSION}, {},
|
|
73
|
+
{}),
|
|
74
|
+
"UpdateRecordPreset": ApiInfo("POST", "/", {"Action": "UpdateRecordPreset", "Version": LIVE_SERVICE_VERSION}, {},
|
|
75
|
+
{}),
|
|
76
|
+
"DeleteRecordPreset": ApiInfo("POST", "/", {"Action": "DeleteRecordPreset", "Version": LIVE_SERVICE_VERSION}, {},
|
|
77
|
+
{}),
|
|
78
|
+
"ListVhostRecordPreset": ApiInfo("POST", "/", {"Action": "ListVhostRecordPreset", "Version": LIVE_SERVICE_VERSION},
|
|
79
|
+
{},
|
|
80
|
+
{}),
|
|
81
|
+
"CreateTranscodePreset": ApiInfo("POST", "/", {"Action": "CreateTranscodePreset", "Version": LIVE_SERVICE_VERSION},
|
|
82
|
+
{},
|
|
83
|
+
{}),
|
|
84
|
+
"UpdateTranscodePreset": ApiInfo("POST", "/", {"Action": "UpdateTranscodePreset", "Version": LIVE_SERVICE_VERSION},
|
|
85
|
+
{},
|
|
86
|
+
{}),
|
|
87
|
+
"DeleteTranscodePreset": ApiInfo("POST", "/", {"Action": "DeleteTranscodePreset", "Version": LIVE_SERVICE_VERSION},
|
|
88
|
+
{},
|
|
89
|
+
{}),
|
|
90
|
+
"ListVhostTransCodePreset": ApiInfo("POST", "/",
|
|
91
|
+
{"Action": "ListVhostTransCodePreset", "Version": LIVE_SERVICE_VERSION}, {},
|
|
92
|
+
{}),
|
|
93
|
+
"CreateSnapshotPreset": ApiInfo("POST", "/", {"Action": "CreateSnapshotPreset", "Version": LIVE_SERVICE_VERSION},
|
|
94
|
+
{},
|
|
95
|
+
{}),
|
|
96
|
+
"UpdateSnapshotPreset": ApiInfo("POST", "/", {"Action": "UpdateSnapshotPreset", "Version": LIVE_SERVICE_VERSION},
|
|
97
|
+
{},
|
|
98
|
+
{}),
|
|
99
|
+
"DeleteSnapshotPreset": ApiInfo("POST", "/", {"Action": "DeleteSnapshotPreset", "Version": LIVE_SERVICE_VERSION},
|
|
100
|
+
{},
|
|
101
|
+
{}),
|
|
102
|
+
"ListVhostSnapshotPreset": ApiInfo("POST", "/",
|
|
103
|
+
{"Action": "ListVhostSnapshotPreset", "Version": LIVE_SERVICE_VERSION}, {},
|
|
104
|
+
{}),
|
|
105
|
+
"DescribeLiveBandwidthData": ApiInfo("POST", "/",
|
|
106
|
+
{"Action": "DescribeLiveBandwidthData", "Version": LIVE_SERVICE_VERSION}, {},
|
|
107
|
+
{}),
|
|
108
|
+
"DescribeLiveTrafficData": ApiInfo("POST", "/",
|
|
109
|
+
{"Action": "DescribeLiveTrafficData", "Version": LIVE_SERVICE_VERSION}, {},
|
|
110
|
+
{}),
|
|
111
|
+
"DescribeLiveP95PeakBandwidthData": ApiInfo("POST", "/",
|
|
112
|
+
{"Action": "DescribeLiveP95PeakBandwidthData",
|
|
113
|
+
"Version": LIVE_SERVICE_VERSION}, {},
|
|
114
|
+
{}),
|
|
115
|
+
"DescribeRecordData": ApiInfo("POST", "/",
|
|
116
|
+
{"Action": "DescribeRecordData", "Version": LIVE_SERVICE_VERSION}, {},
|
|
117
|
+
{}),
|
|
118
|
+
"DescribeTranscodeData": ApiInfo("POST", "/",
|
|
119
|
+
{"Action": "DescribeTranscodeData", "Version": LIVE_SERVICE_VERSION}, {},
|
|
120
|
+
{}),
|
|
121
|
+
"DescribeSnapshotData": ApiInfo("POST", "/",
|
|
122
|
+
{"Action": "DescribeSnapshotData", "Version": LIVE_SERVICE_VERSION}, {},
|
|
123
|
+
{}),
|
|
124
|
+
|
|
125
|
+
"DescribeLiveDomainLog": ApiInfo("GET", "/",
|
|
126
|
+
{"Action": "DescribeLiveDomainLog", "Version": LIVE_SERVICE_VERSION}, {},
|
|
127
|
+
{}),
|
|
128
|
+
"DescribePushStreamMetrics": ApiInfo("POST", "/",
|
|
129
|
+
{"Action": "DescribePushStreamMetrics", "Version": LIVE_SERVICE_VERSION}, {},
|
|
130
|
+
{}),
|
|
131
|
+
"DescribeLiveMetricTrafficData": ApiInfo("POST", "/",
|
|
132
|
+
{"Action": "DescribeLiveMetricTrafficData",
|
|
133
|
+
"Version": LIVE_SERVICE_VERSION}, {},
|
|
134
|
+
{}),
|
|
135
|
+
"DescribeLiveMetricBandwidthData": ApiInfo("POST", "/",
|
|
136
|
+
{"Action": "DescribeLiveMetricBandwidthData",
|
|
137
|
+
"Version": LIVE_SERVICE_VERSION}, {},
|
|
138
|
+
{}),
|
|
139
|
+
"DescribePullToPushBandwidthData": ApiInfo("POST", "/",
|
|
140
|
+
{"Action": "DescribePullToPushBandwidthData",
|
|
141
|
+
"Version": LIVE_SERVICE_VERSION}, {},
|
|
142
|
+
{}),
|
|
143
|
+
"ListStorageSpace": ApiInfo("POST", "/",
|
|
144
|
+
{"Action": "ListStorageSpace",
|
|
145
|
+
"Version": LIVE_SERVICE_VERSION}, {},
|
|
146
|
+
{}),
|
|
147
|
+
"DescribeLiveStorageSpaceData": ApiInfo("POST", "/",
|
|
148
|
+
{"Action": "DescribeLiveStorageSpaceData",
|
|
149
|
+
"Version": LIVE_SERVICE_VERSION}, {},
|
|
150
|
+
{}),
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class LiveService(Service):
|
|
155
|
+
_instance_lock = threading.Lock()
|
|
156
|
+
|
|
157
|
+
def __new__(cls, *args, **kwargs):
|
|
158
|
+
if not hasattr(LiveService, "_instance"):
|
|
159
|
+
with LiveService._instance_lock:
|
|
160
|
+
if not hasattr(LiveService, "_instance"):
|
|
161
|
+
LiveService._instance = object.__new__(cls)
|
|
162
|
+
return LiveService._instance
|
|
163
|
+
|
|
164
|
+
def __init__(self, region=REGION_AP_SINGAPORE1):
|
|
165
|
+
self.service_info = LiveService.get_service_info(region)
|
|
166
|
+
self.api_info = LiveService.get_api_info()
|
|
167
|
+
super(LiveService, self).__init__(self.service_info, self.api_info)
|
|
168
|
+
|
|
169
|
+
@staticmethod
|
|
170
|
+
def get_service_info(region_name):
|
|
171
|
+
service_info = service_info_map.get(region_name, None)
|
|
172
|
+
if not service_info:
|
|
173
|
+
raise Exception('do not support region %s' % region_name)
|
|
174
|
+
return service_info
|
|
175
|
+
|
|
176
|
+
@staticmethod
|
|
177
|
+
def get_api_info():
|
|
178
|
+
return api_info
|
|
179
|
+
|
|
180
|
+
def list_common_trans_preset_detail(self, params):
|
|
181
|
+
action = "ListCommonTransPresetDetail"
|
|
182
|
+
res = self.json(action, dict(), params)
|
|
183
|
+
if res == '':
|
|
184
|
+
raise Exception("%s: empty response" % action)
|
|
185
|
+
res_json = json.loads(res)
|
|
186
|
+
return res_json
|
|
187
|
+
|
|
188
|
+
def update_callback(self, params):
|
|
189
|
+
action = "UpdateCallback"
|
|
190
|
+
res = self.json(action, dict(), params)
|
|
191
|
+
if res == '':
|
|
192
|
+
raise Exception("%s: empty response" % action)
|
|
193
|
+
res_json = json.loads(res)
|
|
194
|
+
return res_json
|
|
195
|
+
|
|
196
|
+
def describe_callback(self, params):
|
|
197
|
+
action = "DescribeCallback"
|
|
198
|
+
res = self.json(action, dict(), params)
|
|
199
|
+
if res == '':
|
|
200
|
+
raise Exception("%s: empty response" % action)
|
|
201
|
+
res_json = json.loads(res)
|
|
202
|
+
return res_json
|
|
203
|
+
|
|
204
|
+
def delete_callback(self, params):
|
|
205
|
+
action = "DeleteCallback"
|
|
206
|
+
res = self.json(action, dict(), params)
|
|
207
|
+
if res == '':
|
|
208
|
+
raise Exception("%s: empty response" % action)
|
|
209
|
+
res_json = json.loads(res)
|
|
210
|
+
return res_json
|
|
211
|
+
|
|
212
|
+
def create_domain(self, params):
|
|
213
|
+
action = "CreateDomain"
|
|
214
|
+
res = self.json(action, dict(), params)
|
|
215
|
+
if res == '':
|
|
216
|
+
raise Exception("%s: empty response" % action)
|
|
217
|
+
res_json = json.loads(res)
|
|
218
|
+
return res_json
|
|
219
|
+
|
|
220
|
+
def delete_domain(self, params):
|
|
221
|
+
action = "DeleteDomain"
|
|
222
|
+
res = self.json(action, dict(), params)
|
|
223
|
+
if res == '':
|
|
224
|
+
raise Exception("%s: empty response" % action)
|
|
225
|
+
res_json = json.loads(res)
|
|
226
|
+
return res_json
|
|
227
|
+
|
|
228
|
+
def list_domain_detail(self, params):
|
|
229
|
+
action = "ListDomainDetail"
|
|
230
|
+
res = self.json(action, dict(), params)
|
|
231
|
+
if res == '':
|
|
232
|
+
raise Exception("%s: empty response" % action)
|
|
233
|
+
res_json = json.loads(res)
|
|
234
|
+
return res_json
|
|
235
|
+
|
|
236
|
+
def describe_domain(self, params):
|
|
237
|
+
action = "DescribeDomain"
|
|
238
|
+
res = self.json(action, dict(), params)
|
|
239
|
+
if res == '':
|
|
240
|
+
raise Exception("%s: empty response" % action)
|
|
241
|
+
res_json = json.loads(res)
|
|
242
|
+
return res_json
|
|
243
|
+
|
|
244
|
+
def enable_domain(self, params):
|
|
245
|
+
action = "EnableDomain"
|
|
246
|
+
res = self.json(action, dict(), params)
|
|
247
|
+
if res == '':
|
|
248
|
+
raise Exception("%s: empty response" % action)
|
|
249
|
+
res_json = json.loads(res)
|
|
250
|
+
return res_json
|
|
251
|
+
|
|
252
|
+
def disable_domain(self, params):
|
|
253
|
+
action = "DisableDomain"
|
|
254
|
+
res = self.json(action, dict(), params)
|
|
255
|
+
if res == '':
|
|
256
|
+
raise Exception("%s: empty response" % action)
|
|
257
|
+
res_json = json.loads(res)
|
|
258
|
+
return res_json
|
|
259
|
+
|
|
260
|
+
def manager_pull_push_domain_bind(self, params):
|
|
261
|
+
action = "ManagerPullPushDomainBind"
|
|
262
|
+
res = self.json(action, dict(), params)
|
|
263
|
+
if res == '':
|
|
264
|
+
raise Exception("%s: empty response" % action)
|
|
265
|
+
res_json = json.loads(res)
|
|
266
|
+
return res_json
|
|
267
|
+
|
|
268
|
+
def update_auth_key(self, params):
|
|
269
|
+
action = "UpdateAuthKey"
|
|
270
|
+
res = self.json(action, dict(), params)
|
|
271
|
+
if res == '':
|
|
272
|
+
raise Exception("%s: empty response" % action)
|
|
273
|
+
res_json = json.loads(res)
|
|
274
|
+
return res_json
|
|
275
|
+
|
|
276
|
+
def describe_auth(self, params):
|
|
277
|
+
action = "DescribeAuth"
|
|
278
|
+
res = self.json(action, dict(), params)
|
|
279
|
+
if res == '':
|
|
280
|
+
raise Exception("%s: empty response" % action)
|
|
281
|
+
res_json = json.loads(res)
|
|
282
|
+
return res_json
|
|
283
|
+
|
|
284
|
+
def forbid_stream(self, params):
|
|
285
|
+
action = "ForbidStream"
|
|
286
|
+
res = self.json(action, dict(), params)
|
|
287
|
+
if res == '':
|
|
288
|
+
raise Exception("%s: empty response" % action)
|
|
289
|
+
res_json = json.loads(res)
|
|
290
|
+
return res_json
|
|
291
|
+
|
|
292
|
+
def resume_stream(self, params):
|
|
293
|
+
action = "ResumeStream"
|
|
294
|
+
res = self.json(action, dict(), params)
|
|
295
|
+
if res == '':
|
|
296
|
+
raise Exception("%s: empty response" % action)
|
|
297
|
+
res_json = json.loads(res)
|
|
298
|
+
return res_json
|
|
299
|
+
|
|
300
|
+
def list_cert(self, params):
|
|
301
|
+
action = "ListCert"
|
|
302
|
+
res = self.json(action, dict(), params)
|
|
303
|
+
if res == '':
|
|
304
|
+
raise Exception("%s: empty response" % action)
|
|
305
|
+
res_json = json.loads(res)
|
|
306
|
+
return res_json
|
|
307
|
+
|
|
308
|
+
def create_cert(self, params):
|
|
309
|
+
action = "CreateCert"
|
|
310
|
+
res = self.json(action, dict(), params)
|
|
311
|
+
if res == '':
|
|
312
|
+
raise Exception("%s: empty response" % action)
|
|
313
|
+
res_json = json.loads(res)
|
|
314
|
+
return res_json
|
|
315
|
+
|
|
316
|
+
def update_cert(self, params):
|
|
317
|
+
action = "UpdateCert"
|
|
318
|
+
res = self.json(action, dict(), params)
|
|
319
|
+
if res == '':
|
|
320
|
+
raise Exception("%s: empty response" % action)
|
|
321
|
+
res_json = json.loads(res)
|
|
322
|
+
return res_json
|
|
323
|
+
|
|
324
|
+
def bind_cert(self, params):
|
|
325
|
+
action = "BindCert"
|
|
326
|
+
res = self.json(action, dict(), params)
|
|
327
|
+
if res == '':
|
|
328
|
+
raise Exception("%s: empty response" % action)
|
|
329
|
+
res_json = json.loads(res)
|
|
330
|
+
return res_json
|
|
331
|
+
|
|
332
|
+
def un_bind_cert(self, params):
|
|
333
|
+
action = "UnbindCert"
|
|
334
|
+
res = self.json(action, dict(), params)
|
|
335
|
+
if res == '':
|
|
336
|
+
raise Exception("%s: empty response" % action)
|
|
337
|
+
res_json = json.loads(res)
|
|
338
|
+
return res_json
|
|
339
|
+
|
|
340
|
+
def delete_cert(self, params):
|
|
341
|
+
action = "DeleteCert"
|
|
342
|
+
res = self.json(action, dict(), params)
|
|
343
|
+
if res == '':
|
|
344
|
+
raise Exception("%s: empty response" % action)
|
|
345
|
+
res_json = json.loads(res)
|
|
346
|
+
return res_json
|
|
347
|
+
|
|
348
|
+
def update_referer(self, params):
|
|
349
|
+
action = "UpdateReferer"
|
|
350
|
+
res = self.json(action, dict(), params)
|
|
351
|
+
if res == '':
|
|
352
|
+
raise Exception("%s: empty response" % action)
|
|
353
|
+
res_json = json.loads(res)
|
|
354
|
+
return res_json
|
|
355
|
+
|
|
356
|
+
def delete_referer(self, params):
|
|
357
|
+
action = "DeleteReferer"
|
|
358
|
+
res = self.json(action, dict(), params)
|
|
359
|
+
if res == '':
|
|
360
|
+
raise Exception("%s: empty response" % action)
|
|
361
|
+
res_json = json.loads(res)
|
|
362
|
+
return res_json
|
|
363
|
+
|
|
364
|
+
def describe_referer(self, params):
|
|
365
|
+
action = "DescribeReferer"
|
|
366
|
+
res = self.json(action, dict(), params)
|
|
367
|
+
if res == '':
|
|
368
|
+
raise Exception("%s: empty response" % action)
|
|
369
|
+
res_json = json.loads(res)
|
|
370
|
+
return res_json
|
|
371
|
+
|
|
372
|
+
def create_record_preset(self, params):
|
|
373
|
+
action = "CreateRecordPreset"
|
|
374
|
+
res = self.json(action, dict(), params)
|
|
375
|
+
if res == '':
|
|
376
|
+
raise Exception("%s: empty response" % action)
|
|
377
|
+
res_json = json.loads(res)
|
|
378
|
+
return res_json
|
|
379
|
+
|
|
380
|
+
def update_record_preset(self, params):
|
|
381
|
+
action = "UpdateRecordPreset"
|
|
382
|
+
res = self.json(action, dict(), params)
|
|
383
|
+
if res == '':
|
|
384
|
+
raise Exception("%s: empty response" % action)
|
|
385
|
+
res_json = json.loads(res)
|
|
386
|
+
return res_json
|
|
387
|
+
|
|
388
|
+
def delete_record_preset(self, params):
|
|
389
|
+
action = "DeleteRecordPreset"
|
|
390
|
+
res = self.json(action, dict(), params)
|
|
391
|
+
if res == '':
|
|
392
|
+
raise Exception("%s: empty response" % action)
|
|
393
|
+
res_json = json.loads(res)
|
|
394
|
+
return res_json
|
|
395
|
+
|
|
396
|
+
def list_vhost_record_preset(self, params):
|
|
397
|
+
action = "ListVhostRecordPreset"
|
|
398
|
+
res = self.json(action, dict(), params)
|
|
399
|
+
if res == '':
|
|
400
|
+
raise Exception("%s: empty response" % action)
|
|
401
|
+
res_json = json.loads(res)
|
|
402
|
+
return res_json
|
|
403
|
+
|
|
404
|
+
def create_transcode_preset(self, params):
|
|
405
|
+
action = "CreateTranscodePreset"
|
|
406
|
+
res = self.json(action, dict(), params)
|
|
407
|
+
if res == '':
|
|
408
|
+
raise Exception("%s: empty response" % action)
|
|
409
|
+
res_json = json.loads(res)
|
|
410
|
+
return res_json
|
|
411
|
+
|
|
412
|
+
def update_transcode_preset(self, params):
|
|
413
|
+
action = "UpdateTranscodePreset"
|
|
414
|
+
res = self.json(action, dict(), params)
|
|
415
|
+
if res == '':
|
|
416
|
+
raise Exception("%s: empty response" % action)
|
|
417
|
+
res_json = json.loads(res)
|
|
418
|
+
return res_json
|
|
419
|
+
|
|
420
|
+
def delete_transcode_preset(self, params):
|
|
421
|
+
action = "DeleteTranscodePreset"
|
|
422
|
+
res = self.json(action, dict(), params)
|
|
423
|
+
if res == '':
|
|
424
|
+
raise Exception("%s: empty response" % action)
|
|
425
|
+
res_json = json.loads(res)
|
|
426
|
+
return res_json
|
|
427
|
+
|
|
428
|
+
def list_vhost_transcode_preset(self, params):
|
|
429
|
+
action = "ListVhostTransCodePreset"
|
|
430
|
+
res = self.json(action, dict(), params)
|
|
431
|
+
if res == '':
|
|
432
|
+
raise Exception("%s: empty response" % action)
|
|
433
|
+
res_json = json.loads(res)
|
|
434
|
+
return res_json
|
|
435
|
+
|
|
436
|
+
def create_snapshot_preset(self, params):
|
|
437
|
+
action = "CreateSnapshotPreset"
|
|
438
|
+
res = self.json(action, dict(), params)
|
|
439
|
+
if res == '':
|
|
440
|
+
raise Exception("%s: empty response" % action)
|
|
441
|
+
res_json = json.loads(res)
|
|
442
|
+
return res_json
|
|
443
|
+
|
|
444
|
+
def update_snapshot_preset(self, params):
|
|
445
|
+
action = "UpdateSnapshotPreset"
|
|
446
|
+
res = self.json(action, dict(), params)
|
|
447
|
+
if res == '':
|
|
448
|
+
raise Exception("%s: empty response" % action)
|
|
449
|
+
res_json = json.loads(res)
|
|
450
|
+
return res_json
|
|
451
|
+
|
|
452
|
+
def delete_snapshot_preset(self, params):
|
|
453
|
+
action = "DeleteSnapshotPreset"
|
|
454
|
+
res = self.json(action, dict(), params)
|
|
455
|
+
if res == '':
|
|
456
|
+
raise Exception("%s: empty response" % action)
|
|
457
|
+
res_json = json.loads(res)
|
|
458
|
+
return res_json
|
|
459
|
+
|
|
460
|
+
def list_vhost_snapshot_preset(self, params):
|
|
461
|
+
action = "ListVhostSnapshotPreset"
|
|
462
|
+
res = self.json(action, dict(), params)
|
|
463
|
+
if res == '':
|
|
464
|
+
raise Exception("%s: empty response" % action)
|
|
465
|
+
res_json = json.loads(res)
|
|
466
|
+
return res_json
|
|
467
|
+
|
|
468
|
+
def describe_live_bandwidth_data(self, params):
|
|
469
|
+
action = "DescribeLiveBandwidthData"
|
|
470
|
+
res = self.json(action, dict(), params)
|
|
471
|
+
if res == '':
|
|
472
|
+
raise Exception("%s: empty response" % action)
|
|
473
|
+
res_json = json.loads(res)
|
|
474
|
+
return res_json
|
|
475
|
+
|
|
476
|
+
def describe_live_traffic_data(self, params):
|
|
477
|
+
action = "DescribeLiveTrafficData"
|
|
478
|
+
res = self.json(action, dict(), params)
|
|
479
|
+
if res == '':
|
|
480
|
+
raise Exception("%s: empty response" % action)
|
|
481
|
+
res_json = json.loads(res)
|
|
482
|
+
return res_json
|
|
483
|
+
|
|
484
|
+
def describe_live_P95Peak_bandwidth_data(self, params):
|
|
485
|
+
action = "DescribeLiveP95PeakBandwidthData"
|
|
486
|
+
res = self.json(action, dict(), params)
|
|
487
|
+
if res == '':
|
|
488
|
+
raise Exception("%s: empty response" % action)
|
|
489
|
+
res_json = json.loads(res)
|
|
490
|
+
return res_json
|
|
491
|
+
|
|
492
|
+
def describe_record_data(self, params):
|
|
493
|
+
action = "DescribeRecordData"
|
|
494
|
+
res = self.json(action, dict(), params)
|
|
495
|
+
if res == '':
|
|
496
|
+
raise Exception("%s: empty response" % action)
|
|
497
|
+
res_json = json.loads(res)
|
|
498
|
+
return res_json
|
|
499
|
+
|
|
500
|
+
def describe_transcode_data(self, params):
|
|
501
|
+
action = "DescribeTranscodeData"
|
|
502
|
+
res = self.json(action, dict(), params)
|
|
503
|
+
if res == '':
|
|
504
|
+
raise Exception("%s: empty response" % action)
|
|
505
|
+
res_json = json.loads(res)
|
|
506
|
+
return res_json
|
|
507
|
+
|
|
508
|
+
def describe_snapshot_data(self, params):
|
|
509
|
+
action = "DescribeSnapshotData"
|
|
510
|
+
res = self.json(action, dict(), params)
|
|
511
|
+
if res == '':
|
|
512
|
+
raise Exception("%s: empty response" % action)
|
|
513
|
+
res_json = json.loads(res)
|
|
514
|
+
return res_json
|
|
515
|
+
|
|
516
|
+
def describe_live_domain_log(self, params):
|
|
517
|
+
action = "DescribeLiveDomainLog"
|
|
518
|
+
res = self.get(action, params)
|
|
519
|
+
# res = self.json(action, dict(), params)
|
|
520
|
+
if res == '':
|
|
521
|
+
raise Exception("%s: empty response" % action)
|
|
522
|
+
res_json = json.loads(res)
|
|
523
|
+
return res_json
|
|
524
|
+
|
|
525
|
+
def describe_push_stream_metrics(self, params):
|
|
526
|
+
action = "DescribePushStreamMetrics"
|
|
527
|
+
res = self.json(action, dict(), params)
|
|
528
|
+
if res == '':
|
|
529
|
+
raise Exception("%s: empty response" % action)
|
|
530
|
+
res_json = json.loads(res)
|
|
531
|
+
return res_json
|
|
532
|
+
|
|
533
|
+
def describe_live_metric_traffic_data(self, params):
|
|
534
|
+
action = "DescribeLiveMetricTrafficData"
|
|
535
|
+
res = self.json(action, dict(), params)
|
|
536
|
+
if res == '':
|
|
537
|
+
raise Exception("%s: empty response" % action)
|
|
538
|
+
res_json = json.loads(res)
|
|
539
|
+
return res_json
|
|
540
|
+
|
|
541
|
+
def describe_live_metric_bandwidth_data(self, params):
|
|
542
|
+
action = "DescribeLiveMetricBandwidthData"
|
|
543
|
+
res = self.json(action, dict(), params)
|
|
544
|
+
if res == '':
|
|
545
|
+
raise Exception("%s: empty response" % action)
|
|
546
|
+
res_json = json.loads(res)
|
|
547
|
+
return res_json
|
|
548
|
+
|
|
549
|
+
def describe_pull_to_push_bandwidth_data(self, params):
|
|
550
|
+
action = "DescribePullToPushBandwidthData"
|
|
551
|
+
res = self.json(action, dict(), params)
|
|
552
|
+
if res == '':
|
|
553
|
+
raise Exception("%s: empty response" % action)
|
|
554
|
+
res_json = json.loads(res)
|
|
555
|
+
return res_json
|
|
556
|
+
|
|
557
|
+
def list_storagespace(self, params):
|
|
558
|
+
action = "ListStorageSpace"
|
|
559
|
+
res = self.json(action, dict(), params)
|
|
560
|
+
if res == '':
|
|
561
|
+
raise Exception("%s: empty response" % action)
|
|
562
|
+
res_json = json.loads(res)
|
|
563
|
+
return res_json
|
|
564
|
+
|
|
565
|
+
def describe_live_storagespace_data(self, params):
|
|
566
|
+
action = "DescribeLiveStorageSpaceData"
|
|
567
|
+
res = self.json(action, dict(), params)
|
|
568
|
+
if res == '':
|
|
569
|
+
raise Exception("%s: empty response" % action)
|
|
570
|
+
res_json = json.loads(res)
|
|
571
|
+
return res_json
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.0.0'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.0.0'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
|
|
3
|
+
from byteplus_sdk.ServiceInfo import ServiceInfo
|
|
4
|
+
from byteplus_sdk.Credentials import Credentials
|
|
5
|
+
from byteplus_sdk.ApiInfo import ApiInfo
|
|
6
|
+
|
|
7
|
+
service_info_map = {
|
|
8
|
+
'cn-north-1': ServiceInfo(
|
|
9
|
+
'open.byteplusapi.com',
|
|
10
|
+
{'Accept': 'application/json'},
|
|
11
|
+
Credentials('', '', 'live', 'cn-north-1'),
|
|
12
|
+
10, 10, "https")
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
api_info = {
|
|
16
|
+
"ListStorageSpace": ApiInfo("POST", "/", {"Action": "ListStorageSpace", "Version": "2020-08-01"}, {}, {}),
|
|
17
|
+
"ListStorageSpaceDetail": ApiInfo("POST", "/", {"Action": "ListStorageSpaceDetail", "Version": "2020-08-01"}, {}, {})
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
from byteplus_sdk.live.v20200801.live_trait import LiveTrait # Modify it if necessary
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class LiveService(LiveTrait):
|
|
6
|
+
def __init__(self, host='open.byteplusapi.com', ak=None, sk=None):
|
|
7
|
+
super().__init__({
|
|
8
|
+
'ak': ak,
|
|
9
|
+
'sk': sk,
|
|
10
|
+
})
|
|
11
|
+
self.set_host(host)
|
|
12
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from byteplus_sdk.base.Service import Service
|
|
5
|
+
from byteplus_sdk.const.Const import *
|
|
6
|
+
from byteplus_sdk.util.Util import *
|
|
7
|
+
from byteplus_sdk.Policy import *
|
|
8
|
+
from byteplus_sdk.live.v20200801.live_config import * # Modify it if necessary
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class LiveTrait(Service):
|
|
12
|
+
def __init__(self, param=None):
|
|
13
|
+
if param is None:
|
|
14
|
+
param = {}
|
|
15
|
+
self.param = param
|
|
16
|
+
region = param.get('region', REGION_CN_NORTH1)
|
|
17
|
+
self.service_info = LiveTrait.get_service_info(region)
|
|
18
|
+
self.api_info = LiveTrait.get_api_info()
|
|
19
|
+
if param.get('ak', None) and param.get('sk', None):
|
|
20
|
+
self.set_ak(param['ak'])
|
|
21
|
+
self.set_sk(param['sk'])
|
|
22
|
+
super(LiveTrait, self).__init__(self.service_info, self.api_info)
|
|
23
|
+
|
|
24
|
+
@staticmethod
|
|
25
|
+
def get_service_info(region):
|
|
26
|
+
service_info = service_info_map.get(region, None)
|
|
27
|
+
if not service_info:
|
|
28
|
+
raise Exception('Not support region %s' % region)
|
|
29
|
+
return service_info
|
|
30
|
+
|
|
31
|
+
@staticmethod
|
|
32
|
+
def get_api_info():
|
|
33
|
+
return api_info
|
|
34
|
+
|
|
35
|
+
def api_get(self, action, params, doseq=0):
|
|
36
|
+
res = self.get(action, params, doseq)
|
|
37
|
+
if res == '':
|
|
38
|
+
raise Exception("%s: empty response" % action)
|
|
39
|
+
res_json = json.loads(json.dumps(res))
|
|
40
|
+
return res_json
|
|
41
|
+
|
|
42
|
+
def api_post(self, action, params, body):
|
|
43
|
+
res = self.json(action, params, body)
|
|
44
|
+
if res == '':
|
|
45
|
+
raise Exception("%s: empty response" % action)
|
|
46
|
+
res_json = json.loads(json.dumps(res))
|
|
47
|
+
return res_json
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def list_storage_space(self, body):
|
|
51
|
+
res = self.api_post('ListStorageSpace', [], body)
|
|
52
|
+
if res == '':
|
|
53
|
+
raise Exception("empty response")
|
|
54
|
+
res_json = json.loads(res)
|
|
55
|
+
return res_json
|
|
56
|
+
|
|
57
|
+
def list_storage_space_detail(self, body):
|
|
58
|
+
res = self.api_post('ListStorageSpaceDetail', [], body)
|
|
59
|
+
if res == '':
|
|
60
|
+
raise Exception("empty response")
|
|
61
|
+
res_json = json.loads(res)
|
|
62
|
+
return res_json
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.0.0'
|