syllable-sdk 0.43.1__py3-none-any.whl → 0.44.1__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.
- syllable_sdk/_version.py +3 -3
- syllable_sdk/agents.py +12 -0
- syllable_sdk/basesdk.py +6 -0
- syllable_sdk/batches.py +18 -0
- syllable_sdk/campaigns.py +10 -0
- syllable_sdk/channels.py +8 -0
- syllable_sdk/conversation_config.py +411 -0
- syllable_sdk/conversations.py +2 -0
- syllable_sdk/custom_messages.py +10 -0
- syllable_sdk/dashboards.py +12 -0
- syllable_sdk/data_sources.py +10 -0
- syllable_sdk/directory.py +16 -0
- syllable_sdk/events.py +2 -0
- syllable_sdk/folders.py +16 -0
- syllable_sdk/full_summary.py +2 -0
- syllable_sdk/incidents.py +12 -0
- syllable_sdk/insights_sdk.py +2 -0
- syllable_sdk/insights_tools.py +14 -0
- syllable_sdk/language_groups.py +12 -0
- syllable_sdk/latency.py +2 -0
- syllable_sdk/models/__init__.py +43 -5
- syllable_sdk/models/bridgephrasesconfig.py +39 -0
- syllable_sdk/models/get_bridge_phrases_configop.py +64 -0
- syllable_sdk/models/pronunciationoverridesdictionary.py +6 -3
- syllable_sdk/models/schemas_cortex_v1_bridge_phrases_dictionarymetadata.py +67 -0
- syllable_sdk/models/{dictionarymetadata.py → schemas_tts_v1_pronunciations_dictionarymetadata.py} +2 -2
- syllable_sdk/models/step.py +2 -2
- syllable_sdk/models/stepeventactions.py +25 -4
- syllable_sdk/models/update_bridge_phrases_configop.py +71 -0
- syllable_sdk/numbers.py +6 -0
- syllable_sdk/organizations.py +8 -0
- syllable_sdk/permissions.py +2 -0
- syllable_sdk/prompts.py +14 -0
- syllable_sdk/pronunciations.py +18 -4
- syllable_sdk/roles.py +10 -0
- syllable_sdk/sdk.py +6 -0
- syllable_sdk/services.py +10 -0
- syllable_sdk/session_debug.py +6 -0
- syllable_sdk/session_labels.py +6 -0
- syllable_sdk/sessions.py +8 -0
- syllable_sdk/takeouts.py +6 -0
- syllable_sdk/targets.py +10 -0
- syllable_sdk/test.py +2 -0
- syllable_sdk/tools.py +10 -0
- syllable_sdk/transcript.py +2 -0
- syllable_sdk/twilio.py +6 -0
- syllable_sdk/users.py +14 -0
- syllable_sdk/utils/forms.py +21 -10
- syllable_sdk/utils/queryparams.py +14 -2
- syllable_sdk/utils/retries.py +69 -5
- syllable_sdk/v1.py +14 -0
- syllable_sdk/voice_groups.py +12 -0
- syllable_sdk/workflows.py +16 -0
- {syllable_sdk-0.43.1.dist-info → syllable_sdk-0.44.1.dist-info}/METADATA +6 -1
- {syllable_sdk-0.43.1.dist-info → syllable_sdk-0.44.1.dist-info}/RECORD +56 -51
- {syllable_sdk-0.43.1.dist-info → syllable_sdk-0.44.1.dist-info}/WHEEL +0 -0
syllable_sdk/test.py
CHANGED
|
@@ -61,6 +61,7 @@ class Test(BaseSDK):
|
|
|
61
61
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
62
62
|
request, False, False, "json", models.TestMessage
|
|
63
63
|
),
|
|
64
|
+
allow_empty_value=None,
|
|
64
65
|
timeout_ms=timeout_ms,
|
|
65
66
|
)
|
|
66
67
|
|
|
@@ -153,6 +154,7 @@ class Test(BaseSDK):
|
|
|
153
154
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
154
155
|
request, False, False, "json", models.TestMessage
|
|
155
156
|
),
|
|
157
|
+
allow_empty_value=None,
|
|
156
158
|
timeout_ms=timeout_ms,
|
|
157
159
|
)
|
|
158
160
|
|
syllable_sdk/tools.py
CHANGED
|
@@ -82,6 +82,7 @@ class Tools(BaseSDK):
|
|
|
82
82
|
accept_header_value="application/json",
|
|
83
83
|
http_headers=http_headers,
|
|
84
84
|
security=self.sdk_configuration.security,
|
|
85
|
+
allow_empty_value=None,
|
|
85
86
|
timeout_ms=timeout_ms,
|
|
86
87
|
)
|
|
87
88
|
|
|
@@ -195,6 +196,7 @@ class Tools(BaseSDK):
|
|
|
195
196
|
accept_header_value="application/json",
|
|
196
197
|
http_headers=http_headers,
|
|
197
198
|
security=self.sdk_configuration.security,
|
|
199
|
+
allow_empty_value=None,
|
|
198
200
|
timeout_ms=timeout_ms,
|
|
199
201
|
)
|
|
200
202
|
|
|
@@ -287,6 +289,7 @@ class Tools(BaseSDK):
|
|
|
287
289
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
288
290
|
request, False, False, "json", models.ToolCreateRequest
|
|
289
291
|
),
|
|
292
|
+
allow_empty_value=None,
|
|
290
293
|
timeout_ms=timeout_ms,
|
|
291
294
|
)
|
|
292
295
|
|
|
@@ -379,6 +382,7 @@ class Tools(BaseSDK):
|
|
|
379
382
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
380
383
|
request, False, False, "json", models.ToolCreateRequest
|
|
381
384
|
),
|
|
385
|
+
allow_empty_value=None,
|
|
382
386
|
timeout_ms=timeout_ms,
|
|
383
387
|
)
|
|
384
388
|
|
|
@@ -471,6 +475,7 @@ class Tools(BaseSDK):
|
|
|
471
475
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
472
476
|
request, False, False, "json", models.ToolUpdateRequest
|
|
473
477
|
),
|
|
478
|
+
allow_empty_value=None,
|
|
474
479
|
timeout_ms=timeout_ms,
|
|
475
480
|
)
|
|
476
481
|
|
|
@@ -563,6 +568,7 @@ class Tools(BaseSDK):
|
|
|
563
568
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
564
569
|
request, False, False, "json", models.ToolUpdateRequest
|
|
565
570
|
),
|
|
571
|
+
allow_empty_value=None,
|
|
566
572
|
timeout_ms=timeout_ms,
|
|
567
573
|
)
|
|
568
574
|
|
|
@@ -652,6 +658,7 @@ class Tools(BaseSDK):
|
|
|
652
658
|
accept_header_value="application/json",
|
|
653
659
|
http_headers=http_headers,
|
|
654
660
|
security=self.sdk_configuration.security,
|
|
661
|
+
allow_empty_value=None,
|
|
655
662
|
timeout_ms=timeout_ms,
|
|
656
663
|
)
|
|
657
664
|
|
|
@@ -741,6 +748,7 @@ class Tools(BaseSDK):
|
|
|
741
748
|
accept_header_value="application/json",
|
|
742
749
|
http_headers=http_headers,
|
|
743
750
|
security=self.sdk_configuration.security,
|
|
751
|
+
allow_empty_value=None,
|
|
744
752
|
timeout_ms=timeout_ms,
|
|
745
753
|
)
|
|
746
754
|
|
|
@@ -833,6 +841,7 @@ class Tools(BaseSDK):
|
|
|
833
841
|
accept_header_value="application/json",
|
|
834
842
|
http_headers=http_headers,
|
|
835
843
|
security=self.sdk_configuration.security,
|
|
844
|
+
allow_empty_value=None,
|
|
836
845
|
timeout_ms=timeout_ms,
|
|
837
846
|
)
|
|
838
847
|
|
|
@@ -925,6 +934,7 @@ class Tools(BaseSDK):
|
|
|
925
934
|
accept_header_value="application/json",
|
|
926
935
|
http_headers=http_headers,
|
|
927
936
|
security=self.sdk_configuration.security,
|
|
937
|
+
allow_empty_value=None,
|
|
928
938
|
timeout_ms=timeout_ms,
|
|
929
939
|
)
|
|
930
940
|
|
syllable_sdk/transcript.py
CHANGED
|
@@ -54,6 +54,7 @@ class Transcript(BaseSDK):
|
|
|
54
54
|
accept_header_value="application/json",
|
|
55
55
|
http_headers=http_headers,
|
|
56
56
|
security=self.sdk_configuration.security,
|
|
57
|
+
allow_empty_value=None,
|
|
57
58
|
timeout_ms=timeout_ms,
|
|
58
59
|
)
|
|
59
60
|
|
|
@@ -143,6 +144,7 @@ class Transcript(BaseSDK):
|
|
|
143
144
|
accept_header_value="application/json",
|
|
144
145
|
http_headers=http_headers,
|
|
145
146
|
security=self.sdk_configuration.security,
|
|
147
|
+
allow_empty_value=None,
|
|
146
148
|
timeout_ms=timeout_ms,
|
|
147
149
|
)
|
|
148
150
|
|
syllable_sdk/twilio.py
CHANGED
|
@@ -72,6 +72,7 @@ class Twilio(BaseSDK):
|
|
|
72
72
|
accept_header_value="application/json",
|
|
73
73
|
http_headers=http_headers,
|
|
74
74
|
security=self.sdk_configuration.security,
|
|
75
|
+
allow_empty_value=None,
|
|
75
76
|
timeout_ms=timeout_ms,
|
|
76
77
|
)
|
|
77
78
|
|
|
@@ -159,6 +160,7 @@ class Twilio(BaseSDK):
|
|
|
159
160
|
accept_header_value="application/json",
|
|
160
161
|
http_headers=http_headers,
|
|
161
162
|
security=self.sdk_configuration.security,
|
|
163
|
+
allow_empty_value=None,
|
|
162
164
|
timeout_ms=timeout_ms,
|
|
163
165
|
)
|
|
164
166
|
|
|
@@ -255,6 +257,7 @@ class Twilio(BaseSDK):
|
|
|
255
257
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
256
258
|
request, False, False, "json", models.TwilioChannelUpdateRequest
|
|
257
259
|
),
|
|
260
|
+
allow_empty_value=None,
|
|
258
261
|
timeout_ms=timeout_ms,
|
|
259
262
|
)
|
|
260
263
|
|
|
@@ -351,6 +354,7 @@ class Twilio(BaseSDK):
|
|
|
351
354
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
352
355
|
request, False, False, "json", models.TwilioChannelUpdateRequest
|
|
353
356
|
),
|
|
357
|
+
allow_empty_value=None,
|
|
354
358
|
timeout_ms=timeout_ms,
|
|
355
359
|
)
|
|
356
360
|
|
|
@@ -447,6 +451,7 @@ class Twilio(BaseSDK):
|
|
|
447
451
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
448
452
|
request, False, False, "json", models.TwilioChannelCreateRequest
|
|
449
453
|
),
|
|
454
|
+
allow_empty_value=None,
|
|
450
455
|
timeout_ms=timeout_ms,
|
|
451
456
|
)
|
|
452
457
|
|
|
@@ -543,6 +548,7 @@ class Twilio(BaseSDK):
|
|
|
543
548
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
544
549
|
request, False, False, "json", models.TwilioChannelCreateRequest
|
|
545
550
|
),
|
|
551
|
+
allow_empty_value=None,
|
|
546
552
|
timeout_ms=timeout_ms,
|
|
547
553
|
)
|
|
548
554
|
|
syllable_sdk/users.py
CHANGED
|
@@ -80,6 +80,7 @@ class Users(BaseSDK):
|
|
|
80
80
|
accept_header_value="application/json",
|
|
81
81
|
http_headers=http_headers,
|
|
82
82
|
security=self.sdk_configuration.security,
|
|
83
|
+
allow_empty_value=None,
|
|
83
84
|
timeout_ms=timeout_ms,
|
|
84
85
|
)
|
|
85
86
|
|
|
@@ -193,6 +194,7 @@ class Users(BaseSDK):
|
|
|
193
194
|
accept_header_value="application/json",
|
|
194
195
|
http_headers=http_headers,
|
|
195
196
|
security=self.sdk_configuration.security,
|
|
197
|
+
allow_empty_value=None,
|
|
196
198
|
timeout_ms=timeout_ms,
|
|
197
199
|
)
|
|
198
200
|
|
|
@@ -285,6 +287,7 @@ class Users(BaseSDK):
|
|
|
285
287
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
286
288
|
request, False, False, "json", models.UserCreateRequest
|
|
287
289
|
),
|
|
290
|
+
allow_empty_value=None,
|
|
288
291
|
timeout_ms=timeout_ms,
|
|
289
292
|
)
|
|
290
293
|
|
|
@@ -377,6 +380,7 @@ class Users(BaseSDK):
|
|
|
377
380
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
378
381
|
request, False, False, "json", models.UserCreateRequest
|
|
379
382
|
),
|
|
383
|
+
allow_empty_value=None,
|
|
380
384
|
timeout_ms=timeout_ms,
|
|
381
385
|
)
|
|
382
386
|
|
|
@@ -469,6 +473,7 @@ class Users(BaseSDK):
|
|
|
469
473
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
470
474
|
request, False, False, "json", models.UserUpdateRequest
|
|
471
475
|
),
|
|
476
|
+
allow_empty_value=None,
|
|
472
477
|
timeout_ms=timeout_ms,
|
|
473
478
|
)
|
|
474
479
|
|
|
@@ -561,6 +566,7 @@ class Users(BaseSDK):
|
|
|
561
566
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
562
567
|
request, False, False, "json", models.UserUpdateRequest
|
|
563
568
|
),
|
|
569
|
+
allow_empty_value=None,
|
|
564
570
|
timeout_ms=timeout_ms,
|
|
565
571
|
)
|
|
566
572
|
|
|
@@ -653,6 +659,7 @@ class Users(BaseSDK):
|
|
|
653
659
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
654
660
|
request, False, False, "json", models.UserDeleteRequest
|
|
655
661
|
),
|
|
662
|
+
allow_empty_value=None,
|
|
656
663
|
timeout_ms=timeout_ms,
|
|
657
664
|
)
|
|
658
665
|
|
|
@@ -745,6 +752,7 @@ class Users(BaseSDK):
|
|
|
745
752
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
746
753
|
request, False, False, "json", models.UserDeleteRequest
|
|
747
754
|
),
|
|
755
|
+
allow_empty_value=None,
|
|
748
756
|
timeout_ms=timeout_ms,
|
|
749
757
|
)
|
|
750
758
|
|
|
@@ -834,6 +842,7 @@ class Users(BaseSDK):
|
|
|
834
842
|
accept_header_value="application/json",
|
|
835
843
|
http_headers=http_headers,
|
|
836
844
|
security=self.sdk_configuration.security,
|
|
845
|
+
allow_empty_value=None,
|
|
837
846
|
timeout_ms=timeout_ms,
|
|
838
847
|
)
|
|
839
848
|
|
|
@@ -923,6 +932,7 @@ class Users(BaseSDK):
|
|
|
923
932
|
accept_header_value="application/json",
|
|
924
933
|
http_headers=http_headers,
|
|
925
934
|
security=self.sdk_configuration.security,
|
|
935
|
+
allow_empty_value=None,
|
|
926
936
|
timeout_ms=timeout_ms,
|
|
927
937
|
)
|
|
928
938
|
|
|
@@ -1015,6 +1025,7 @@ class Users(BaseSDK):
|
|
|
1015
1025
|
accept_header_value="application/json",
|
|
1016
1026
|
http_headers=http_headers,
|
|
1017
1027
|
security=self.sdk_configuration.security,
|
|
1028
|
+
allow_empty_value=None,
|
|
1018
1029
|
timeout_ms=timeout_ms,
|
|
1019
1030
|
)
|
|
1020
1031
|
|
|
@@ -1107,6 +1118,7 @@ class Users(BaseSDK):
|
|
|
1107
1118
|
accept_header_value="application/json",
|
|
1108
1119
|
http_headers=http_headers,
|
|
1109
1120
|
security=self.sdk_configuration.security,
|
|
1121
|
+
allow_empty_value=None,
|
|
1110
1122
|
timeout_ms=timeout_ms,
|
|
1111
1123
|
)
|
|
1112
1124
|
|
|
@@ -1190,6 +1202,7 @@ class Users(BaseSDK):
|
|
|
1190
1202
|
accept_header_value="application/json",
|
|
1191
1203
|
http_headers=http_headers,
|
|
1192
1204
|
security=self.sdk_configuration.security,
|
|
1205
|
+
allow_empty_value=None,
|
|
1193
1206
|
timeout_ms=timeout_ms,
|
|
1194
1207
|
)
|
|
1195
1208
|
|
|
@@ -1267,6 +1280,7 @@ class Users(BaseSDK):
|
|
|
1267
1280
|
accept_header_value="application/json",
|
|
1268
1281
|
http_headers=http_headers,
|
|
1269
1282
|
security=self.sdk_configuration.security,
|
|
1283
|
+
allow_empty_value=None,
|
|
1270
1284
|
timeout_ms=timeout_ms,
|
|
1271
1285
|
)
|
|
1272
1286
|
|
syllable_sdk/utils/forms.py
CHANGED
|
@@ -142,16 +142,21 @@ def serialize_multipart_form(
|
|
|
142
142
|
if field_metadata.file:
|
|
143
143
|
if isinstance(val, List):
|
|
144
144
|
# Handle array of files
|
|
145
|
+
array_field_name = f_name + "[]"
|
|
145
146
|
for file_obj in val:
|
|
146
147
|
if not _is_set(file_obj):
|
|
147
148
|
continue
|
|
148
|
-
|
|
149
|
-
file_name, content, content_type = _extract_file_properties(
|
|
149
|
+
|
|
150
|
+
file_name, content, content_type = _extract_file_properties(
|
|
151
|
+
file_obj
|
|
152
|
+
)
|
|
150
153
|
|
|
151
154
|
if content_type is not None:
|
|
152
|
-
files.append(
|
|
155
|
+
files.append(
|
|
156
|
+
(array_field_name, (file_name, content, content_type))
|
|
157
|
+
)
|
|
153
158
|
else:
|
|
154
|
-
files.append((
|
|
159
|
+
files.append((array_field_name, (file_name, content)))
|
|
155
160
|
else:
|
|
156
161
|
# Handle single file
|
|
157
162
|
file_name, content, content_type = _extract_file_properties(val)
|
|
@@ -161,11 +166,16 @@ def serialize_multipart_form(
|
|
|
161
166
|
else:
|
|
162
167
|
files.append((f_name, (file_name, content)))
|
|
163
168
|
elif field_metadata.json:
|
|
164
|
-
files.append(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
files.append(
|
|
170
|
+
(
|
|
171
|
+
f_name,
|
|
172
|
+
(
|
|
173
|
+
None,
|
|
174
|
+
marshal_json(val, request_field_types[name]),
|
|
175
|
+
"application/json",
|
|
176
|
+
),
|
|
177
|
+
)
|
|
178
|
+
)
|
|
169
179
|
else:
|
|
170
180
|
if isinstance(val, List):
|
|
171
181
|
values = []
|
|
@@ -175,7 +185,8 @@ def serialize_multipart_form(
|
|
|
175
185
|
continue
|
|
176
186
|
values.append(_val_to_string(value))
|
|
177
187
|
|
|
178
|
-
|
|
188
|
+
array_field_name = f_name + "[]"
|
|
189
|
+
form[array_field_name] = values
|
|
179
190
|
else:
|
|
180
191
|
form[f_name] = _val_to_string(val)
|
|
181
192
|
return media_type, form, files
|
|
@@ -27,12 +27,13 @@ from .forms import _populate_form
|
|
|
27
27
|
def get_query_params(
|
|
28
28
|
query_params: Any,
|
|
29
29
|
gbls: Optional[Any] = None,
|
|
30
|
+
allow_empty_value: Optional[List[str]] = None,
|
|
30
31
|
) -> Dict[str, List[str]]:
|
|
31
32
|
params: Dict[str, List[str]] = {}
|
|
32
33
|
|
|
33
|
-
globals_already_populated = _populate_query_params(query_params, gbls, params, [])
|
|
34
|
+
globals_already_populated = _populate_query_params(query_params, gbls, params, [], allow_empty_value)
|
|
34
35
|
if _is_set(gbls):
|
|
35
|
-
_populate_query_params(gbls, None, params, globals_already_populated)
|
|
36
|
+
_populate_query_params(gbls, None, params, globals_already_populated, allow_empty_value)
|
|
36
37
|
|
|
37
38
|
return params
|
|
38
39
|
|
|
@@ -42,6 +43,7 @@ def _populate_query_params(
|
|
|
42
43
|
gbls: Any,
|
|
43
44
|
query_param_values: Dict[str, List[str]],
|
|
44
45
|
skip_fields: List[str],
|
|
46
|
+
allow_empty_value: Optional[List[str]] = None,
|
|
45
47
|
) -> List[str]:
|
|
46
48
|
globals_already_populated: List[str] = []
|
|
47
49
|
|
|
@@ -69,6 +71,16 @@ def _populate_query_params(
|
|
|
69
71
|
globals_already_populated.append(name)
|
|
70
72
|
|
|
71
73
|
f_name = field.alias if field.alias is not None else name
|
|
74
|
+
|
|
75
|
+
allow_empty_set = set(allow_empty_value or [])
|
|
76
|
+
should_include_empty = f_name in allow_empty_set and (
|
|
77
|
+
value is None or value == [] or value == ""
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
if should_include_empty:
|
|
81
|
+
query_param_values[f_name] = [""]
|
|
82
|
+
continue
|
|
83
|
+
|
|
72
84
|
serialization = metadata.serialization
|
|
73
85
|
if serialization is not None:
|
|
74
86
|
serialized_parms = _get_serialized_params(
|
syllable_sdk/utils/retries.py
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import random
|
|
5
5
|
import time
|
|
6
|
-
from
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from email.utils import parsedate_to_datetime
|
|
8
|
+
from typing import List, Optional
|
|
7
9
|
|
|
8
10
|
import httpx
|
|
9
11
|
|
|
@@ -51,9 +53,11 @@ class Retries:
|
|
|
51
53
|
|
|
52
54
|
class TemporaryError(Exception):
|
|
53
55
|
response: httpx.Response
|
|
56
|
+
retry_after: Optional[int]
|
|
54
57
|
|
|
55
58
|
def __init__(self, response: httpx.Response):
|
|
56
59
|
self.response = response
|
|
60
|
+
self.retry_after = _parse_retry_after_header(response)
|
|
57
61
|
|
|
58
62
|
|
|
59
63
|
class PermanentError(Exception):
|
|
@@ -63,6 +67,62 @@ class PermanentError(Exception):
|
|
|
63
67
|
self.inner = inner
|
|
64
68
|
|
|
65
69
|
|
|
70
|
+
def _parse_retry_after_header(response: httpx.Response) -> Optional[int]:
|
|
71
|
+
"""Parse Retry-After header from response.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Retry interval in milliseconds, or None if header is missing or invalid.
|
|
75
|
+
"""
|
|
76
|
+
retry_after_header = response.headers.get("retry-after")
|
|
77
|
+
if not retry_after_header:
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
try:
|
|
81
|
+
seconds = float(retry_after_header)
|
|
82
|
+
return round(seconds * 1000)
|
|
83
|
+
except ValueError:
|
|
84
|
+
pass
|
|
85
|
+
|
|
86
|
+
try:
|
|
87
|
+
retry_date = parsedate_to_datetime(retry_after_header)
|
|
88
|
+
delta = (retry_date - datetime.now(retry_date.tzinfo)).total_seconds()
|
|
89
|
+
return round(max(0, delta) * 1000)
|
|
90
|
+
except (ValueError, TypeError):
|
|
91
|
+
pass
|
|
92
|
+
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _get_sleep_interval(
|
|
97
|
+
exception: Exception,
|
|
98
|
+
initial_interval: int,
|
|
99
|
+
max_interval: int,
|
|
100
|
+
exponent: float,
|
|
101
|
+
retries: int,
|
|
102
|
+
) -> float:
|
|
103
|
+
"""Get sleep interval for retry with exponential backoff.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
exception: The exception that triggered the retry.
|
|
107
|
+
initial_interval: Initial retry interval in milliseconds.
|
|
108
|
+
max_interval: Maximum retry interval in milliseconds.
|
|
109
|
+
exponent: Base for exponential backoff calculation.
|
|
110
|
+
retries: Current retry attempt count.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
Sleep interval in seconds.
|
|
114
|
+
"""
|
|
115
|
+
if (
|
|
116
|
+
isinstance(exception, TemporaryError)
|
|
117
|
+
and exception.retry_after is not None
|
|
118
|
+
and exception.retry_after > 0
|
|
119
|
+
):
|
|
120
|
+
return exception.retry_after / 1000
|
|
121
|
+
|
|
122
|
+
sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1)
|
|
123
|
+
return min(sleep, max_interval / 1000)
|
|
124
|
+
|
|
125
|
+
|
|
66
126
|
def retry(func, retries: Retries):
|
|
67
127
|
if retries.config.strategy == "backoff":
|
|
68
128
|
|
|
@@ -183,8 +243,10 @@ def retry_with_backoff(
|
|
|
183
243
|
return exception.response
|
|
184
244
|
|
|
185
245
|
raise
|
|
186
|
-
|
|
187
|
-
sleep =
|
|
246
|
+
|
|
247
|
+
sleep = _get_sleep_interval(
|
|
248
|
+
exception, initial_interval, max_interval, exponent, retries
|
|
249
|
+
)
|
|
188
250
|
time.sleep(sleep)
|
|
189
251
|
retries += 1
|
|
190
252
|
|
|
@@ -211,7 +273,9 @@ async def retry_with_backoff_async(
|
|
|
211
273
|
return exception.response
|
|
212
274
|
|
|
213
275
|
raise
|
|
214
|
-
|
|
215
|
-
sleep =
|
|
276
|
+
|
|
277
|
+
sleep = _get_sleep_interval(
|
|
278
|
+
exception, initial_interval, max_interval, exponent, retries
|
|
279
|
+
)
|
|
216
280
|
await asyncio.sleep(sleep)
|
|
217
281
|
retries += 1
|
syllable_sdk/v1.py
CHANGED
|
@@ -80,6 +80,7 @@ class V1(BaseSDK):
|
|
|
80
80
|
accept_header_value="application/json",
|
|
81
81
|
http_headers=http_headers,
|
|
82
82
|
security=self.sdk_configuration.security,
|
|
83
|
+
allow_empty_value=None,
|
|
83
84
|
timeout_ms=timeout_ms,
|
|
84
85
|
)
|
|
85
86
|
|
|
@@ -193,6 +194,7 @@ class V1(BaseSDK):
|
|
|
193
194
|
accept_header_value="application/json",
|
|
194
195
|
http_headers=http_headers,
|
|
195
196
|
security=self.sdk_configuration.security,
|
|
197
|
+
allow_empty_value=None,
|
|
196
198
|
timeout_ms=timeout_ms,
|
|
197
199
|
)
|
|
198
200
|
|
|
@@ -285,6 +287,7 @@ class V1(BaseSDK):
|
|
|
285
287
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
286
288
|
request, False, False, "json", models.UserCreateRequest
|
|
287
289
|
),
|
|
290
|
+
allow_empty_value=None,
|
|
288
291
|
timeout_ms=timeout_ms,
|
|
289
292
|
)
|
|
290
293
|
|
|
@@ -377,6 +380,7 @@ class V1(BaseSDK):
|
|
|
377
380
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
378
381
|
request, False, False, "json", models.UserCreateRequest
|
|
379
382
|
),
|
|
383
|
+
allow_empty_value=None,
|
|
380
384
|
timeout_ms=timeout_ms,
|
|
381
385
|
)
|
|
382
386
|
|
|
@@ -469,6 +473,7 @@ class V1(BaseSDK):
|
|
|
469
473
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
470
474
|
request, False, False, "json", models.UserUpdateRequest
|
|
471
475
|
),
|
|
476
|
+
allow_empty_value=None,
|
|
472
477
|
timeout_ms=timeout_ms,
|
|
473
478
|
)
|
|
474
479
|
|
|
@@ -561,6 +566,7 @@ class V1(BaseSDK):
|
|
|
561
566
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
562
567
|
request, False, False, "json", models.UserUpdateRequest
|
|
563
568
|
),
|
|
569
|
+
allow_empty_value=None,
|
|
564
570
|
timeout_ms=timeout_ms,
|
|
565
571
|
)
|
|
566
572
|
|
|
@@ -653,6 +659,7 @@ class V1(BaseSDK):
|
|
|
653
659
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
654
660
|
request, False, False, "json", models.UserDeleteRequest
|
|
655
661
|
),
|
|
662
|
+
allow_empty_value=None,
|
|
656
663
|
timeout_ms=timeout_ms,
|
|
657
664
|
)
|
|
658
665
|
|
|
@@ -745,6 +752,7 @@ class V1(BaseSDK):
|
|
|
745
752
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
746
753
|
request, False, False, "json", models.UserDeleteRequest
|
|
747
754
|
),
|
|
755
|
+
allow_empty_value=None,
|
|
748
756
|
timeout_ms=timeout_ms,
|
|
749
757
|
)
|
|
750
758
|
|
|
@@ -834,6 +842,7 @@ class V1(BaseSDK):
|
|
|
834
842
|
accept_header_value="application/json",
|
|
835
843
|
http_headers=http_headers,
|
|
836
844
|
security=self.sdk_configuration.security,
|
|
845
|
+
allow_empty_value=None,
|
|
837
846
|
timeout_ms=timeout_ms,
|
|
838
847
|
)
|
|
839
848
|
|
|
@@ -923,6 +932,7 @@ class V1(BaseSDK):
|
|
|
923
932
|
accept_header_value="application/json",
|
|
924
933
|
http_headers=http_headers,
|
|
925
934
|
security=self.sdk_configuration.security,
|
|
935
|
+
allow_empty_value=None,
|
|
926
936
|
timeout_ms=timeout_ms,
|
|
927
937
|
)
|
|
928
938
|
|
|
@@ -1015,6 +1025,7 @@ class V1(BaseSDK):
|
|
|
1015
1025
|
accept_header_value="application/json",
|
|
1016
1026
|
http_headers=http_headers,
|
|
1017
1027
|
security=self.sdk_configuration.security,
|
|
1028
|
+
allow_empty_value=None,
|
|
1018
1029
|
timeout_ms=timeout_ms,
|
|
1019
1030
|
)
|
|
1020
1031
|
|
|
@@ -1107,6 +1118,7 @@ class V1(BaseSDK):
|
|
|
1107
1118
|
accept_header_value="application/json",
|
|
1108
1119
|
http_headers=http_headers,
|
|
1109
1120
|
security=self.sdk_configuration.security,
|
|
1121
|
+
allow_empty_value=None,
|
|
1110
1122
|
timeout_ms=timeout_ms,
|
|
1111
1123
|
)
|
|
1112
1124
|
|
|
@@ -1190,6 +1202,7 @@ class V1(BaseSDK):
|
|
|
1190
1202
|
accept_header_value="application/json",
|
|
1191
1203
|
http_headers=http_headers,
|
|
1192
1204
|
security=self.sdk_configuration.security,
|
|
1205
|
+
allow_empty_value=None,
|
|
1193
1206
|
timeout_ms=timeout_ms,
|
|
1194
1207
|
)
|
|
1195
1208
|
|
|
@@ -1267,6 +1280,7 @@ class V1(BaseSDK):
|
|
|
1267
1280
|
accept_header_value="application/json",
|
|
1268
1281
|
http_headers=http_headers,
|
|
1269
1282
|
security=self.sdk_configuration.security,
|
|
1283
|
+
allow_empty_value=None,
|
|
1270
1284
|
timeout_ms=timeout_ms,
|
|
1271
1285
|
)
|
|
1272
1286
|
|
syllable_sdk/voice_groups.py
CHANGED
|
@@ -81,6 +81,7 @@ class VoiceGroups(BaseSDK):
|
|
|
81
81
|
accept_header_value="application/json",
|
|
82
82
|
http_headers=http_headers,
|
|
83
83
|
security=self.sdk_configuration.security,
|
|
84
|
+
allow_empty_value=None,
|
|
84
85
|
timeout_ms=timeout_ms,
|
|
85
86
|
)
|
|
86
87
|
|
|
@@ -196,6 +197,7 @@ class VoiceGroups(BaseSDK):
|
|
|
196
197
|
accept_header_value="application/json",
|
|
197
198
|
http_headers=http_headers,
|
|
198
199
|
security=self.sdk_configuration.security,
|
|
200
|
+
allow_empty_value=None,
|
|
199
201
|
timeout_ms=timeout_ms,
|
|
200
202
|
)
|
|
201
203
|
|
|
@@ -292,6 +294,7 @@ class VoiceGroups(BaseSDK):
|
|
|
292
294
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
293
295
|
request, False, False, "json", models.VoiceGroupCreateRequest
|
|
294
296
|
),
|
|
297
|
+
allow_empty_value=None,
|
|
295
298
|
timeout_ms=timeout_ms,
|
|
296
299
|
)
|
|
297
300
|
|
|
@@ -386,6 +389,7 @@ class VoiceGroups(BaseSDK):
|
|
|
386
389
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
387
390
|
request, False, False, "json", models.VoiceGroupCreateRequest
|
|
388
391
|
),
|
|
392
|
+
allow_empty_value=None,
|
|
389
393
|
timeout_ms=timeout_ms,
|
|
390
394
|
)
|
|
391
395
|
|
|
@@ -480,6 +484,7 @@ class VoiceGroups(BaseSDK):
|
|
|
480
484
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
481
485
|
request, False, False, "json", models.VoiceGroupUpdateRequest
|
|
482
486
|
),
|
|
487
|
+
allow_empty_value=None,
|
|
483
488
|
timeout_ms=timeout_ms,
|
|
484
489
|
)
|
|
485
490
|
|
|
@@ -574,6 +579,7 @@ class VoiceGroups(BaseSDK):
|
|
|
574
579
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
575
580
|
request, False, False, "json", models.VoiceGroupUpdateRequest
|
|
576
581
|
),
|
|
582
|
+
allow_empty_value=None,
|
|
577
583
|
timeout_ms=timeout_ms,
|
|
578
584
|
)
|
|
579
585
|
|
|
@@ -663,6 +669,7 @@ class VoiceGroups(BaseSDK):
|
|
|
663
669
|
accept_header_value="application/json",
|
|
664
670
|
http_headers=http_headers,
|
|
665
671
|
security=self.sdk_configuration.security,
|
|
672
|
+
allow_empty_value=None,
|
|
666
673
|
timeout_ms=timeout_ms,
|
|
667
674
|
)
|
|
668
675
|
|
|
@@ -752,6 +759,7 @@ class VoiceGroups(BaseSDK):
|
|
|
752
759
|
accept_header_value="application/json",
|
|
753
760
|
http_headers=http_headers,
|
|
754
761
|
security=self.sdk_configuration.security,
|
|
762
|
+
allow_empty_value=None,
|
|
755
763
|
timeout_ms=timeout_ms,
|
|
756
764
|
)
|
|
757
765
|
|
|
@@ -844,6 +852,7 @@ class VoiceGroups(BaseSDK):
|
|
|
844
852
|
accept_header_value="application/json",
|
|
845
853
|
http_headers=http_headers,
|
|
846
854
|
security=self.sdk_configuration.security,
|
|
855
|
+
allow_empty_value=None,
|
|
847
856
|
timeout_ms=timeout_ms,
|
|
848
857
|
)
|
|
849
858
|
|
|
@@ -936,6 +945,7 @@ class VoiceGroups(BaseSDK):
|
|
|
936
945
|
accept_header_value="application/json",
|
|
937
946
|
http_headers=http_headers,
|
|
938
947
|
security=self.sdk_configuration.security,
|
|
948
|
+
allow_empty_value=None,
|
|
939
949
|
timeout_ms=timeout_ms,
|
|
940
950
|
)
|
|
941
951
|
|
|
@@ -1030,6 +1040,7 @@ class VoiceGroups(BaseSDK):
|
|
|
1030
1040
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1031
1041
|
request, False, False, "json", models.VoiceSampleCreateRequest
|
|
1032
1042
|
),
|
|
1043
|
+
allow_empty_value=None,
|
|
1033
1044
|
timeout_ms=timeout_ms,
|
|
1034
1045
|
)
|
|
1035
1046
|
|
|
@@ -1127,6 +1138,7 @@ class VoiceGroups(BaseSDK):
|
|
|
1127
1138
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1128
1139
|
request, False, False, "json", models.VoiceSampleCreateRequest
|
|
1129
1140
|
),
|
|
1141
|
+
allow_empty_value=None,
|
|
1130
1142
|
timeout_ms=timeout_ms,
|
|
1131
1143
|
)
|
|
1132
1144
|
|