byteplus-python-sdk-v2 3.0.56__py2.py3-none-any.whl → 3.0.57__py2.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_python_sdk_v2-3.0.56.dist-info → byteplus_python_sdk_v2-3.0.57.dist-info}/METADATA +1 -1
- {byteplus_python_sdk_v2-3.0.56.dist-info → byteplus_python_sdk_v2-3.0.57.dist-info}/RECORD +10 -10
- byteplussdkcore/api_client.py +1 -1
- byteplussdkcore/configuration.py +1 -1
- byteplussdkcore/endpoint/providers/default_provider.py +128 -247
- byteplussdkcore/endpoint/providers/standard_provider.py +18 -13
- {byteplus_python_sdk_v2-3.0.56.dist-info → byteplus_python_sdk_v2-3.0.57.dist-info}/WHEEL +0 -0
- {byteplus_python_sdk_v2-3.0.56.dist-info → byteplus_python_sdk_v2-3.0.57.dist-info}/licenses/LICENSE.txt +0 -0
- {byteplus_python_sdk_v2-3.0.56.dist-info → byteplus_python_sdk_v2-3.0.57.dist-info}/licenses/NOTICE.md +0 -0
- {byteplus_python_sdk_v2-3.0.56.dist-info → byteplus_python_sdk_v2-3.0.57.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
byteplus_python_sdk_v2-3.0.
|
|
2
|
-
byteplus_python_sdk_v2-3.0.
|
|
1
|
+
byteplus_python_sdk_v2-3.0.57.dist-info/licenses/LICENSE.txt,sha256=jG2zQEdRNt88EgHUWPpXVWmOrOduUQRx7MnYV9YIPaw,11359
|
|
2
|
+
byteplus_python_sdk_v2-3.0.57.dist-info/licenses/NOTICE.md,sha256=vSw_bTkZl1MYBrGol3tpO6B6OLLFRpaw0z5cun0_0QE,85
|
|
3
3
|
byteplussdkalb/__init__.py,sha256=hgNQF2o0CFabtxQHh0xHHZ5oHcz3bQ6wHpRkA9B8nuo,30746
|
|
4
4
|
byteplussdkalb/api/__init__.py,sha256=H6iQBCnNKuvuPDr57uNOlglabIkEAd4CncI0rnwwEoE,133
|
|
5
5
|
byteplussdkalb/api/alb_api.py,sha256=kWP7DNDolXb02v4nD5VmEjSmeddM-aBrHPGCIdC7ogY,249907
|
|
@@ -2076,8 +2076,8 @@ byteplussdkcloudmonitor/models/update_silence_policy_response.py,sha256=3PZTcDF2
|
|
|
2076
2076
|
byteplussdkcloudmonitor/models/update_webhook_request.py,sha256=UuA9Ua57eLThwa7cVq5xPegHf-e3W2aGti5CLTBYf1U,7041
|
|
2077
2077
|
byteplussdkcloudmonitor/models/update_webhook_response.py,sha256=Icjg1daq1uG0V3l7R_QVPkHvLCe1uXU1OphnDhoZ91A,3424
|
|
2078
2078
|
byteplussdkcore/__init__.py,sha256=QD2qSwKMsMeYxsEQIdWce5ekPilRexqkWCP_q3YOqvo,308
|
|
2079
|
-
byteplussdkcore/api_client.py,sha256=
|
|
2080
|
-
byteplussdkcore/configuration.py,sha256=
|
|
2079
|
+
byteplussdkcore/api_client.py,sha256=XXms3Y_lAkLGL8wQfdsEaHQMGFT7bKLD3PlpiGBTqVM,28251
|
|
2080
|
+
byteplussdkcore/configuration.py,sha256=mUj9Icy0f6ri7J4PgYjuqS2f2_BqyJ0TcHZ2nMMeJLE,11924
|
|
2081
2081
|
byteplussdkcore/endpoint.py,sha256=L5Dw0-Cia9ezYxGJFgZ9td-mCM4AqSIZv67ll1sSzMY,1630
|
|
2082
2082
|
byteplussdkcore/flatten.py,sha256=g3r61JS_AO7WV6ClRDkXgtnVXcw3c7tbZjeLAJxkSLc,3811
|
|
2083
2083
|
byteplussdkcore/metadata.py,sha256=Km5jOllvPViXn0rdx604nIq0OF1RBF3Q2x-xA2cDXc8,4518
|
|
@@ -2100,8 +2100,8 @@ byteplussdkcore/auth/providers/sts_saml_provider.py,sha256=yedLynY4rwG81Xm9y2vfa
|
|
|
2100
2100
|
byteplussdkcore/endpoint/__init__.py,sha256=K7dXFGGh0QYiALOLgtPxboGYzwCJB5IHseGSQPObZdQ,117
|
|
2101
2101
|
byteplussdkcore/endpoint/endpoint_provider.py,sha256=9ajUjf2N2NmThuWrMm5QgLtmh8YbPas5TdvkAZYQ9lM,330
|
|
2102
2102
|
byteplussdkcore/endpoint/providers/__init__.py,sha256=FmxBi_siUNTZod9GFOk5VG-UVYT7daNt4hZ2zifqYY8,76
|
|
2103
|
-
byteplussdkcore/endpoint/providers/default_provider.py,sha256=
|
|
2104
|
-
byteplussdkcore/endpoint/providers/standard_provider.py,sha256=
|
|
2103
|
+
byteplussdkcore/endpoint/providers/default_provider.py,sha256=fKlBzYXjws9qGNJswN9SrQYpaqIP7HlOZkEvbls2jY8,10352
|
|
2104
|
+
byteplussdkcore/endpoint/providers/standard_provider.py,sha256=UjRAIoU8A-xPOn-KjrbdbC42W55vSAq640VBgyrFRng,12784
|
|
2105
2105
|
byteplussdkcore/feature/__init__.py,sha256=ev2S2XGLZUjbL7sylBd3NWmqGmcDcYV-Oj4qPZOztHU,154
|
|
2106
2106
|
byteplussdkcore/feature/rds/__init__.py,sha256=g4-6e-OdBADN9_WzILg8P69KdSVSc5TyOg5CrXglE5A,119
|
|
2107
2107
|
byteplussdkcore/feature/rds/connect_utils.py,sha256=Z_sJjNdRYXUKP9Ygi4tNWnUWBH-ueYekb3E0SW2vAPY,3177
|
|
@@ -10818,7 +10818,7 @@ byteplussdkvs20260714/models/create_voice_task_response.py,sha256=OXVaSMuIQeR-3K
|
|
|
10818
10818
|
byteplussdkvs20260714/models/data_for_create_voice_task_output.py,sha256=3AHvvVdW-XqrWaemto4rTkAGH7xC5LIECPM31j_v5D0,3526
|
|
10819
10819
|
byteplussdkvs20260714/models/number_info_list_for_create_voice_task_input.py,sha256=nRyRZ8MvLxJpdNNV3htDSWDkcwDR6fskvq0cT5z5Cuw,4503
|
|
10820
10820
|
byteplussdkvs20260714/models/voice_content_for_create_voice_task_input.py,sha256=x8z0fVEr0Uay3FuhGGJm5vrLdFMT5Qr2srJDUA3C_jA,8119
|
|
10821
|
-
byteplus_python_sdk_v2-3.0.
|
|
10822
|
-
byteplus_python_sdk_v2-3.0.
|
|
10823
|
-
byteplus_python_sdk_v2-3.0.
|
|
10824
|
-
byteplus_python_sdk_v2-3.0.
|
|
10821
|
+
byteplus_python_sdk_v2-3.0.57.dist-info/METADATA,sha256=XeTyjzV1yQjSrRhddec-fu2T7qDHzgeSp0zbQQTe1f4,4824
|
|
10822
|
+
byteplus_python_sdk_v2-3.0.57.dist-info/WHEEL,sha256=qWEHOWeXof9kJLXAXJ1hukQ_MvVtaV9UUAew6N7Y99E,109
|
|
10823
|
+
byteplus_python_sdk_v2-3.0.57.dist-info/top_level.txt,sha256=-iSSKg52spQd1bbe9WcS7sHO_gVkw5TPmFWg7vPjItE,1163
|
|
10824
|
+
byteplus_python_sdk_v2-3.0.57.dist-info/RECORD,,
|
byteplussdkcore/api_client.py
CHANGED
|
@@ -68,7 +68,7 @@ class ApiClient(object):
|
|
|
68
68
|
self.default_headers[header_name] = header_value
|
|
69
69
|
self.cookie = cookie
|
|
70
70
|
# Set default User-Agent.
|
|
71
|
-
self.user_agent = 'byteplus-python-sdk-v2/3.0.
|
|
71
|
+
self.user_agent = 'byteplus-python-sdk-v2/3.0.57'
|
|
72
72
|
self.client_side_validation = configuration.client_side_validation
|
|
73
73
|
|
|
74
74
|
self.interceptor_chain = InterceptorChain()
|
byteplussdkcore/configuration.py
CHANGED
|
@@ -287,7 +287,7 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|
|
287
287
|
"OS: {env}\n" \
|
|
288
288
|
"Python Version: {pyversion}\n" \
|
|
289
289
|
"Version of the API: 0.1.0\n" \
|
|
290
|
-
"SDK Package Version: 3.0.
|
|
290
|
+
"SDK Package Version: 3.0.57".\
|
|
291
291
|
format(env=sys.platform, pyversion=sys.version)
|
|
292
292
|
|
|
293
293
|
@property
|
|
@@ -8,47 +8,78 @@ from byteplussdkcore.observability.debugger import sdk_core_logger
|
|
|
8
8
|
open_prefix = 'open'
|
|
9
9
|
endpoint_suffix = '.byteplusapi.com'
|
|
10
10
|
dualstack_endpoint_suffix = '.byteplus-api.com'
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ServiceEndpointInfoMissingError(Exception):
|
|
14
|
+
"""Raised when a service is not registered in ``default_endpoint``.
|
|
15
|
+
|
|
16
|
+
Mirrors Go's ``ErrServiceEndpointInfoMissing`` and Java's ``ApiException``
|
|
17
|
+
thrown by ``DefaultEndpointProvider.getDefaultEndpointByServiceInfo`` for
|
|
18
|
+
the same condition.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
self.service = service
|
|
23
|
+
super(ServiceEndpointInfoMissingError, self).__init__(
|
|
24
|
+
"byteplussdkcore: service endpoint info missing: service {!r} "
|
|
25
|
+
"not registered".format(service)
|
|
26
|
+
)
|
|
12
27
|
|
|
13
28
|
region_code_cn_beijing_auto_driving = "cn-beijing-autodriving"
|
|
14
29
|
region_code_ap_southeast2 = "ap-southeast-2"
|
|
15
30
|
region_code_ap_southeast3 = "ap-southeast-3"
|
|
16
31
|
region_code_cn_hongkong = 'cn-hongkong'
|
|
17
32
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
33
|
+
# Region-level whitelist of cn-* regions that should resolve to the
|
|
34
|
+
# international ``.byteplusapi.com`` suffix rather than the Chinese mainland
|
|
35
|
+
# ``.byteplusapi.com.cn`` suffix.
|
|
36
|
+
_cn_non_mainland_region_set = {region_code_cn_hongkong}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _normalize_region(region):
|
|
40
|
+
if region is None:
|
|
41
|
+
return ''
|
|
42
|
+
return region.strip().lower()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _is_cn_mainland_region(region):
|
|
46
|
+
"""Returns whether ``region`` is a mainland cn-* region resolving to the
|
|
47
|
+
``.byteplusapi.com.cn`` suffix. Regions in :data:`_cn_non_mainland_region_set`
|
|
48
|
+
(for example ``cn-hongkong``) are treated as international.
|
|
49
|
+
"""
|
|
50
|
+
if not region.startswith('cn-'):
|
|
51
|
+
return False
|
|
52
|
+
return region not in _cn_non_mainland_region_set
|
|
22
53
|
|
|
23
54
|
|
|
24
55
|
class ServiceEndpointInfo:
|
|
25
56
|
|
|
26
|
-
def __init__(self, service, is_global,
|
|
27
|
-
|
|
57
|
+
def __init__(self, service, is_global, go_china_enabled=False,
|
|
58
|
+
global_endpoint='', region_endpoint_map=None):
|
|
28
59
|
self.service = service
|
|
29
60
|
self.is_global = is_global
|
|
61
|
+
self.go_china_enabled = go_china_enabled
|
|
62
|
+
# Optional overrides retained for ``custom_endpoints`` callers. The
|
|
63
|
+
# built-in ``default_endpoint`` table intentionally leaves them empty
|
|
64
|
+
# and drives resolution off ``is_global`` + ``go_china_enabled``, in
|
|
65
|
+
# line with the Go/Java ``ServiceEndpointInfo`` shape.
|
|
30
66
|
self.global_endpoint = global_endpoint
|
|
31
|
-
self.region_endpoint_map = region_endpoint_map
|
|
32
|
-
self.fallback_endpoint = fallback_endpoint
|
|
67
|
+
self.region_endpoint_map = region_endpoint_map or {}
|
|
33
68
|
|
|
34
69
|
@property
|
|
35
70
|
def __standardize_domain_service_code(self):
|
|
36
71
|
return self.service.lower().replace('_', '-')
|
|
37
72
|
|
|
38
|
-
@staticmethod
|
|
39
|
-
def __is_cn_region(region):
|
|
40
|
-
has_cn_prefix = region.startswith('cn-')
|
|
41
|
-
if not has_cn_prefix:
|
|
42
|
-
return False
|
|
43
|
-
|
|
44
|
-
cn_none_mainland_region = [region_code_cn_hongkong]
|
|
45
|
-
return region not in cn_none_mainland_region
|
|
46
|
-
|
|
47
73
|
def get_endpoint_for(self, region, suffix=endpoint_suffix):
|
|
48
74
|
sdk_core_logger.debug_endpoint(
|
|
49
75
|
"get_endpoint_for start: service=%s, region=%s, suffix=%s",
|
|
50
76
|
self.service, region, suffix
|
|
51
77
|
)
|
|
78
|
+
|
|
79
|
+
normalized_region = _normalize_region(region)
|
|
80
|
+
cn_suffix = '.cn' if (self.go_china_enabled
|
|
81
|
+
and _is_cn_mainland_region(normalized_region)) else ''
|
|
82
|
+
|
|
52
83
|
if self.is_global:
|
|
53
84
|
if self.global_endpoint:
|
|
54
85
|
sdk_core_logger.debug_endpoint(
|
|
@@ -56,197 +87,83 @@ class ServiceEndpointInfo:
|
|
|
56
87
|
self.service, self.global_endpoint
|
|
57
88
|
)
|
|
58
89
|
return self.global_endpoint
|
|
59
|
-
endpoint = self.__standardize_domain_service_code + suffix
|
|
90
|
+
endpoint = self.__standardize_domain_service_code + suffix + cn_suffix
|
|
60
91
|
sdk_core_logger.debug_endpoint(
|
|
61
92
|
"build global endpoint from service code: %s", endpoint
|
|
62
93
|
)
|
|
63
94
|
return endpoint
|
|
64
|
-
|
|
65
|
-
|
|
95
|
+
|
|
96
|
+
if normalized_region in self.region_endpoint_map:
|
|
97
|
+
endpoint = self.region_endpoint_map[normalized_region]
|
|
66
98
|
sdk_core_logger.debug_endpoint(
|
|
67
99
|
"use region endpoint from map: service=%s, region=%s, endpoint=%s",
|
|
68
100
|
self.service, region, endpoint
|
|
69
101
|
)
|
|
70
102
|
return endpoint
|
|
71
103
|
|
|
72
|
-
endpoint = self.__standardize_domain_service_code + '.'
|
|
73
|
-
|
|
104
|
+
endpoint = (self.__standardize_domain_service_code + '.'
|
|
105
|
+
+ normalized_region + suffix + cn_suffix)
|
|
74
106
|
sdk_core_logger.debug_endpoint(
|
|
75
107
|
"build region endpoint by default rule: %s", endpoint
|
|
76
108
|
)
|
|
77
|
-
|
|
78
109
|
return endpoint
|
|
79
110
|
|
|
80
111
|
|
|
81
112
|
default_endpoint = {
|
|
82
|
-
'
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
),
|
|
89
|
-
'
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
),
|
|
96
|
-
'
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
),
|
|
103
|
-
'
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
),
|
|
110
|
-
'
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
),
|
|
117
|
-
'
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
),
|
|
124
|
-
'
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
),
|
|
131
|
-
'
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
fallback_endpoint=fallback_endpoint,
|
|
137
|
-
),
|
|
138
|
-
'cpaas': ServiceEndpointInfo(
|
|
139
|
-
service='cpaas',
|
|
140
|
-
is_global=True,
|
|
141
|
-
global_endpoint='',
|
|
142
|
-
region_endpoint_map={},
|
|
143
|
-
fallback_endpoint=fallback_endpoint,
|
|
144
|
-
),
|
|
145
|
-
'vepfs': ServiceEndpointInfo(
|
|
146
|
-
service='vepfs',
|
|
147
|
-
is_global=False,
|
|
148
|
-
global_endpoint='',
|
|
149
|
-
region_endpoint_map={},
|
|
150
|
-
fallback_endpoint=fallback_endpoint,
|
|
151
|
-
),
|
|
152
|
-
'vke': ServiceEndpointInfo(
|
|
153
|
-
service='vke',
|
|
154
|
-
is_global=False,
|
|
155
|
-
global_endpoint='',
|
|
156
|
-
region_endpoint_map={},
|
|
157
|
-
fallback_endpoint=fallback_endpoint,
|
|
158
|
-
),
|
|
159
|
-
'kickart': ServiceEndpointInfo(
|
|
160
|
-
service='kickart',
|
|
161
|
-
is_global=True,
|
|
162
|
-
global_endpoint='',
|
|
163
|
-
region_endpoint_map={},
|
|
164
|
-
fallback_endpoint=fallback_endpoint,
|
|
165
|
-
),
|
|
166
|
-
'rds_mssql': ServiceEndpointInfo(
|
|
167
|
-
service='rds_mssql',
|
|
168
|
-
is_global=False,
|
|
169
|
-
global_endpoint='',
|
|
170
|
-
region_endpoint_map={},
|
|
171
|
-
fallback_endpoint=fallback_endpoint,
|
|
172
|
-
),
|
|
173
|
-
'sts': ServiceEndpointInfo(
|
|
174
|
-
service='sts',
|
|
175
|
-
is_global=False,
|
|
176
|
-
global_endpoint='',
|
|
177
|
-
region_endpoint_map={},
|
|
178
|
-
fallback_endpoint=fallback_endpoint,
|
|
179
|
-
),
|
|
180
|
-
'redis': ServiceEndpointInfo(
|
|
181
|
-
service='redis',
|
|
182
|
-
is_global=False,
|
|
183
|
-
global_endpoint='',
|
|
184
|
-
region_endpoint_map={},
|
|
185
|
-
fallback_endpoint=fallback_endpoint,
|
|
186
|
-
),
|
|
187
|
-
'vmp': ServiceEndpointInfo(
|
|
188
|
-
service='vmp',
|
|
189
|
-
is_global=False,
|
|
190
|
-
global_endpoint='',
|
|
191
|
-
region_endpoint_map={},
|
|
192
|
-
fallback_endpoint=fallback_endpoint,
|
|
193
|
-
),
|
|
194
|
-
'vs': ServiceEndpointInfo(
|
|
195
|
-
service='vs',
|
|
196
|
-
is_global=True,
|
|
197
|
-
global_endpoint='',
|
|
198
|
-
region_endpoint_map={},
|
|
199
|
-
fallback_endpoint=fallback_endpoint,
|
|
200
|
-
),
|
|
201
|
-
'resourcecenter': ServiceEndpointInfo(
|
|
202
|
-
service='resourcecenter',
|
|
203
|
-
is_global=True,
|
|
204
|
-
global_endpoint='',
|
|
205
|
-
region_endpoint_map={},
|
|
206
|
-
fallback_endpoint=fallback_endpoint,
|
|
207
|
-
),
|
|
208
|
-
'rds_mysql': ServiceEndpointInfo(
|
|
209
|
-
service='rds_mysql',
|
|
210
|
-
is_global=False,
|
|
211
|
-
global_endpoint='',
|
|
212
|
-
region_endpoint_map={},
|
|
213
|
-
fallback_endpoint=fallback_endpoint,
|
|
214
|
-
),
|
|
215
|
-
'privatelink': ServiceEndpointInfo(
|
|
216
|
-
service='privatelink',
|
|
217
|
-
is_global=False,
|
|
218
|
-
global_endpoint='',
|
|
219
|
-
region_endpoint_map={},
|
|
220
|
-
fallback_endpoint=fallback_endpoint,
|
|
221
|
-
),
|
|
222
|
-
'cen': ServiceEndpointInfo(
|
|
223
|
-
service='cen',
|
|
224
|
-
is_global=True,
|
|
225
|
-
global_endpoint='',
|
|
226
|
-
region_endpoint_map={},
|
|
227
|
-
fallback_endpoint=fallback_endpoint,
|
|
228
|
-
),
|
|
229
|
-
'seccenter': ServiceEndpointInfo(
|
|
230
|
-
service='seccenter',
|
|
231
|
-
is_global=True,
|
|
232
|
-
global_endpoint='',
|
|
233
|
-
region_endpoint_map={},
|
|
234
|
-
fallback_endpoint=fallback_endpoint,
|
|
235
|
-
),
|
|
236
|
-
'transitrouter': ServiceEndpointInfo(
|
|
237
|
-
service='transitrouter',
|
|
238
|
-
is_global=False,
|
|
239
|
-
global_endpoint='',
|
|
240
|
-
region_endpoint_map={},
|
|
241
|
-
fallback_endpoint=fallback_endpoint,
|
|
242
|
-
),
|
|
243
|
-
'clawsentry': ServiceEndpointInfo(
|
|
244
|
-
service='clawsentry',
|
|
245
|
-
is_global=False,
|
|
246
|
-
global_endpoint='',
|
|
247
|
-
region_endpoint_map={},
|
|
248
|
-
fallback_endpoint=fallback_endpoint,
|
|
249
|
-
),
|
|
113
|
+
'vpc': ServiceEndpointInfo('vpc', False, True),
|
|
114
|
+
'vke': ServiceEndpointInfo('vke', False, True),
|
|
115
|
+
'auto_scaling': ServiceEndpointInfo('auto_scaling', False, True),
|
|
116
|
+
'storage_ebs': ServiceEndpointInfo('storage_ebs', False, True),
|
|
117
|
+
'vedbm': ServiceEndpointInfo('vedbm', False, True),
|
|
118
|
+
'privatelink': ServiceEndpointInfo('privatelink', False, True),
|
|
119
|
+
'clb': ServiceEndpointInfo('clb', False, True),
|
|
120
|
+
'transitrouter': ServiceEndpointInfo('transitrouter', False, True),
|
|
121
|
+
'directconnect': ServiceEndpointInfo('directconnect', False, True),
|
|
122
|
+
'vpn': ServiceEndpointInfo('vpn', False, True),
|
|
123
|
+
'natgateway': ServiceEndpointInfo('natgateway', False, True),
|
|
124
|
+
'rds_mysql': ServiceEndpointInfo('rds_mysql', False, True),
|
|
125
|
+
'smc': ServiceEndpointInfo('smc', True, False),
|
|
126
|
+
'iam': ServiceEndpointInfo('iam', True, True),
|
|
127
|
+
'vepfs': ServiceEndpointInfo('vepfs', False, True),
|
|
128
|
+
'kms': ServiceEndpointInfo('kms', False, True),
|
|
129
|
+
'ecs': ServiceEndpointInfo('ecs', False, True),
|
|
130
|
+
'mongodb': ServiceEndpointInfo('mongodb', False, True),
|
|
131
|
+
'private_zone': ServiceEndpointInfo('private_zone', True, True),
|
|
132
|
+
'rds_postgresql': ServiceEndpointInfo('rds_postgresql', False, True),
|
|
133
|
+
'resource_share': ServiceEndpointInfo('resource_share', True, False),
|
|
134
|
+
'vmp': ServiceEndpointInfo('vmp', False, True),
|
|
135
|
+
'tag': ServiceEndpointInfo('tag', True, False),
|
|
136
|
+
'cr': ServiceEndpointInfo('cr', False, True),
|
|
137
|
+
'alb': ServiceEndpointInfo('alb', False, True),
|
|
138
|
+
'sts': ServiceEndpointInfo('sts', False, True),
|
|
139
|
+
'hbase': ServiceEndpointInfo('hbase', False, True),
|
|
140
|
+
'rds_mssql': ServiceEndpointInfo('rds_mssql', False, True),
|
|
141
|
+
'ml_platform': ServiceEndpointInfo('ml_platform', False, False),
|
|
142
|
+
'apig': ServiceEndpointInfo('apig', False, False),
|
|
143
|
+
'ark': ServiceEndpointInfo('ark', False, False),
|
|
144
|
+
'waf': ServiceEndpointInfo('waf', True, False),
|
|
145
|
+
'quota': ServiceEndpointInfo('quota', True, False),
|
|
146
|
+
'dms': ServiceEndpointInfo('dms', False, True),
|
|
147
|
+
'vefaas': ServiceEndpointInfo('vefaas', False, False),
|
|
148
|
+
'cen': ServiceEndpointInfo('cen', True, False),
|
|
149
|
+
'cp': ServiceEndpointInfo('cp', False, False),
|
|
150
|
+
'cloudmonitor': ServiceEndpointInfo('cloudmonitor', False, True),
|
|
151
|
+
'eco_partner': ServiceEndpointInfo('eco_partner', True, False),
|
|
152
|
+
'milvus': ServiceEndpointInfo('milvus', False, False),
|
|
153
|
+
'llmshield': ServiceEndpointInfo('llmshield', False, False),
|
|
154
|
+
'billing': ServiceEndpointInfo('billing', True, True),
|
|
155
|
+
'id': ServiceEndpointInfo('id', False, False),
|
|
156
|
+
'clawsentry': ServiceEndpointInfo('clawsentry', False, False),
|
|
157
|
+
'resourcecenter': ServiceEndpointInfo('resourcecenter', True, False),
|
|
158
|
+
'escloud': ServiceEndpointInfo('escloud', False, False),
|
|
159
|
+
'cpaas': ServiceEndpointInfo('cpaas', True, False),
|
|
160
|
+
'filenas': ServiceEndpointInfo('filenas', False, True),
|
|
161
|
+
'kafka': ServiceEndpointInfo('kafka', False, True),
|
|
162
|
+
'kickart': ServiceEndpointInfo('kickart', True, False),
|
|
163
|
+
'rabbitmq': ServiceEndpointInfo('rabbitmq', False, False),
|
|
164
|
+
'redis': ServiceEndpointInfo('redis', False, True),
|
|
165
|
+
'vod': ServiceEndpointInfo('vod', False, False),
|
|
166
|
+
'vs': ServiceEndpointInfo('vs', True, False),
|
|
250
167
|
}
|
|
251
168
|
|
|
252
169
|
|
|
@@ -260,49 +177,19 @@ class DefaultEndpointProvider(EndpointProvider):
|
|
|
260
177
|
"get_default_endpoint: service=%s, region=%s, suffix=%s",
|
|
261
178
|
service, region, suffix
|
|
262
179
|
)
|
|
263
|
-
if service in default_endpoint:
|
|
264
|
-
e = default_endpoint[service]
|
|
265
|
-
endpoint = e.get_endpoint_for(region, suffix)
|
|
180
|
+
if service not in default_endpoint:
|
|
266
181
|
sdk_core_logger.debug_endpoint(
|
|
267
|
-
"
|
|
268
|
-
service, endpoint
|
|
182
|
+
"service %s not registered in default_endpoint", service
|
|
269
183
|
)
|
|
270
|
-
|
|
184
|
+
raise ServiceEndpointInfoMissingError(service)
|
|
271
185
|
|
|
186
|
+
e = default_endpoint[service]
|
|
187
|
+
endpoint = e.get_endpoint_for(region, suffix)
|
|
272
188
|
sdk_core_logger.debug_endpoint(
|
|
273
|
-
"
|
|
189
|
+
"resolved default endpoint: service=%s, endpoint=%s",
|
|
190
|
+
service, endpoint
|
|
274
191
|
)
|
|
275
|
-
return
|
|
276
|
-
|
|
277
|
-
def __in_bootstrap_region_list(self, region, custom_bootstrap_region):
|
|
278
|
-
region_code = region.strip()
|
|
279
|
-
bs_region_list_path = os.getenv('BYTEPLUS_BOOTSTRAP_REGION_LIST_CONF')
|
|
280
|
-
if bs_region_list_path:
|
|
281
|
-
try:
|
|
282
|
-
with open(bs_region_list_path, 'r') as f:
|
|
283
|
-
content = f.read()
|
|
284
|
-
lines = content.split('\n')
|
|
285
|
-
for line in lines:
|
|
286
|
-
line = line.strip()
|
|
287
|
-
if not line:
|
|
288
|
-
continue
|
|
289
|
-
if line == region_code:
|
|
290
|
-
return True
|
|
291
|
-
except Exception as e:
|
|
292
|
-
warnings.warn(
|
|
293
|
-
'failed to read bootstrap region list from file ' + bs_region_list_path + ': ' + str(e),
|
|
294
|
-
Warning,
|
|
295
|
-
stacklevel=2
|
|
296
|
-
)
|
|
297
|
-
|
|
298
|
-
if bootstrap_region:
|
|
299
|
-
if region_code in bootstrap_region:
|
|
300
|
-
return True
|
|
301
|
-
|
|
302
|
-
if custom_bootstrap_region:
|
|
303
|
-
return region_code in custom_bootstrap_region
|
|
304
|
-
|
|
305
|
-
return False
|
|
192
|
+
return endpoint
|
|
306
193
|
|
|
307
194
|
@staticmethod
|
|
308
195
|
def __has_enabled_dualstack(use_dual_stack):
|
|
@@ -315,6 +202,17 @@ class DefaultEndpointProvider(EndpointProvider):
|
|
|
315
202
|
"endpoint_for called: service=%s, region=%s, custom_bootstrap_region=%s, use_dual_stack=%s",
|
|
316
203
|
service, region, custom_bootstrap_region, use_dual_stack
|
|
317
204
|
)
|
|
205
|
+
|
|
206
|
+
# custom_bootstrap_region is deprecated and no longer participates in
|
|
207
|
+
# addressing. Retained in the signature for API compatibility.
|
|
208
|
+
if custom_bootstrap_region:
|
|
209
|
+
warnings.warn(
|
|
210
|
+
'custom_bootstrap_region is deprecated and no longer affects '
|
|
211
|
+
'endpoint resolution; the value is ignored.',
|
|
212
|
+
DeprecationWarning,
|
|
213
|
+
stacklevel=2,
|
|
214
|
+
)
|
|
215
|
+
|
|
318
216
|
if service in self.custom_endpoints:
|
|
319
217
|
conf = self.custom_endpoints[service]
|
|
320
218
|
host = conf.get_endpoint_for(region)
|
|
@@ -324,23 +222,6 @@ class DefaultEndpointProvider(EndpointProvider):
|
|
|
324
222
|
)
|
|
325
223
|
return ResolvedEndpoint(host)
|
|
326
224
|
|
|
327
|
-
if custom_bootstrap_region is None:
|
|
328
|
-
custom_bootstrap_region = {}
|
|
329
|
-
|
|
330
|
-
if not self.__in_bootstrap_region_list(region, custom_bootstrap_region):
|
|
331
|
-
if service not in default_endpoint:
|
|
332
|
-
sdk_core_logger.debug_endpoint(
|
|
333
|
-
"region=%s not in bootstrap list, service not in default endpoint fallback=%s",
|
|
334
|
-
region, fallback_endpoint
|
|
335
|
-
)
|
|
336
|
-
return ResolvedEndpoint(fallback_endpoint)
|
|
337
|
-
host = default_endpoint[service].fallback_endpoint
|
|
338
|
-
sdk_core_logger.debug_endpoint(
|
|
339
|
-
"region=%s not in bootstrap list, service in default endpoint fallback=%s",
|
|
340
|
-
region, host
|
|
341
|
-
)
|
|
342
|
-
return ResolvedEndpoint(host)
|
|
343
|
-
|
|
344
225
|
suffix = dualstack_endpoint_suffix if self.__has_enabled_dualstack(use_dual_stack) else endpoint_suffix
|
|
345
226
|
|
|
346
227
|
host = self.get_default_endpoint(service=service, region=region, suffix=suffix)
|
|
@@ -273,9 +273,9 @@ def is_go_china(region):
|
|
|
273
273
|
class StandardEndpointResolver(EndpointProvider):
|
|
274
274
|
def __init__(self, fmt=None, site_stack=None, extension=None, custom_services=None):
|
|
275
275
|
self.fmt = fmt or DEFAULT_FORMAT
|
|
276
|
-
|
|
277
|
-
self.
|
|
278
|
-
self.
|
|
276
|
+
# 只保存不可变配置模板;请求级 variables 在 endpoint_for 内每次新建,避免跨请求残留和并发串扰
|
|
277
|
+
self._default_site_stack = site_stack or SITE_STACK_BYTEPLUS_IPV4
|
|
278
|
+
self._default_extension = extension or {}
|
|
279
279
|
self.custom_services = custom_services or {}
|
|
280
280
|
|
|
281
281
|
def endpoint_for(self, service, region, custom_bootstrap_region=None, use_dual_stack=None, **kwargs):
|
|
@@ -290,8 +290,10 @@ class StandardEndpointResolver(EndpointProvider):
|
|
|
290
290
|
# 2) 默认模板
|
|
291
291
|
fmt = self.fmt or DEFAULT_FORMAT
|
|
292
292
|
|
|
293
|
-
# 3)
|
|
294
|
-
|
|
293
|
+
# 3) 请求级 variables:每次新建,防止跨请求残留与并发串扰
|
|
294
|
+
variables = StandardEndpointResolverVariable()
|
|
295
|
+
variables.extension = dict(self._default_extension)
|
|
296
|
+
variables.service = standardize_domain_service_code(service)
|
|
295
297
|
|
|
296
298
|
svc_info = ServiceInfos.get(service)
|
|
297
299
|
if not svc_info:
|
|
@@ -305,22 +307,25 @@ class StandardEndpointResolver(EndpointProvider):
|
|
|
305
307
|
|
|
306
308
|
# 非全局服务拼接 ".{region}",全局则为空
|
|
307
309
|
if not svc_info.IsGlobal:
|
|
308
|
-
|
|
310
|
+
variables.region = "." + region
|
|
309
311
|
else:
|
|
310
|
-
|
|
312
|
+
variables.region = ""
|
|
311
313
|
|
|
312
314
|
# 4) IP 版本 -> SiteStack
|
|
313
315
|
if use_dual_stack:
|
|
314
|
-
|
|
316
|
+
variables.site_stack = SITE_STACK_BYTEPLUS_DUAL_STACK
|
|
315
317
|
else:
|
|
316
|
-
|
|
318
|
+
variables.site_stack = self._default_site_stack
|
|
317
319
|
|
|
320
|
+
# 5) CNSuffix:非全局 + 中国大陆才追加,其他情况显式清空
|
|
318
321
|
if not svc_info.IsGlobal and is_go_china(region):
|
|
319
|
-
|
|
322
|
+
variables.cn_suffix = CN_SUFFIX
|
|
323
|
+
else:
|
|
324
|
+
variables.cn_suffix = ""
|
|
320
325
|
|
|
321
|
-
#
|
|
326
|
+
# 6) 渲染
|
|
322
327
|
try:
|
|
323
|
-
rendered = fmt.format(**
|
|
328
|
+
rendered = fmt.format(**variables.to_dict())
|
|
324
329
|
except KeyError as err:
|
|
325
330
|
raise StandProviderError(
|
|
326
331
|
"TemplateExecuteError",
|
|
@@ -329,7 +334,7 @@ class StandardEndpointResolver(EndpointProvider):
|
|
|
329
334
|
except Exception as err:
|
|
330
335
|
raise StandProviderError(
|
|
331
336
|
"TemplateExecuteError",
|
|
332
|
-
"failed to execute template for format %s, variable %r: %s" % (fmt,
|
|
337
|
+
"failed to execute template for format %s, variable %r: %s" % (fmt, variables.to_dict(), err)
|
|
333
338
|
)
|
|
334
339
|
|
|
335
340
|
return ResolvedEndpoint(rendered)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{byteplus_python_sdk_v2-3.0.56.dist-info → byteplus_python_sdk_v2-3.0.57.dist-info}/top_level.txt
RENAMED
|
File without changes
|