murf 1.2.3__tar.gz → 2.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of murf might be problematic. Click here for more details.
- {murf-1.2.3 → murf-2.2.3}/PKG-INFO +1 -1
- {murf-1.2.3 → murf-2.2.3}/pyproject.toml +1 -1
- {murf-1.2.3 → murf-2.2.3}/src/murf/__init__.py +38 -3
- {murf-1.2.3 → murf-2.2.3}/src/murf/auth/client.py +11 -9
- {murf-1.2.3 → murf-2.2.3}/src/murf/base_client.py +3 -20
- {murf-1.2.3 → murf-2.2.3}/src/murf/client.py +0 -8
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/__init__.py +4 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/client_wrapper.py +18 -17
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/http_client.py +6 -6
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/pydantic_utilities.py +2 -2
- murf-2.2.3/src/murf/core/unchecked_base_model.py +305 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/jobs/client.py +37 -31
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/languages/client.py +25 -21
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/projects/client.py +45 -33
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing_client.py +0 -8
- murf-2.2.3/src/murf/environment.py +58 -0
- murf-2.2.3/src/murf/stream_input/__init__.py +5 -0
- murf-2.2.3/src/murf/stream_input/types/__init__.py +7 -0
- murf-2.2.3/src/murf/stream_input/types/receive_message.py +7 -0
- murf-2.2.3/src/murf/stream_input/types/send_message.py +9 -0
- murf-2.2.3/src/murf/stream_input/types/text_to_speech_model.py +5 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/text/client.py +15 -13
- {murf-1.2.3 → murf-2.2.3}/src/murf/text_to_speech/client.py +153 -58
- murf-2.2.3/src/murf/types/__init__.py +99 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/api_job_response.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/api_project_response.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/api_voice.py +2 -2
- murf-2.2.3/src/murf/types/audio_output.py +27 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/auth_token_response.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/character_count.py +2 -2
- murf-2.2.3/src/murf/types/clear_context.py +20 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/dub_api_detail_response.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/dub_job_status_response.py +2 -2
- murf-2.2.3/src/murf/types/final_output.py +27 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/form_data_content_disposition.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/generate_speech_response.py +6 -6
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/group_api_project_response.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/locale_response.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/metadata.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/murf_api_translation_response.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/pronunciation_detail.py +2 -2
- murf-2.2.3/src/murf/types/send_text.py +35 -0
- murf-2.2.3/src/murf/types/send_text_voice_config.py +55 -0
- murf-2.2.3/src/murf/types/send_text_voice_config_pronunciation_dictionary_value.py +30 -0
- murf-2.2.3/src/murf/types/send_text_voice_config_pronunciation_dictionary_value_type.py +5 -0
- murf-2.2.3/src/murf/types/set_advanced_settings.py +20 -0
- murf-2.2.3/src/murf/types/set_voice_configuration_or_initialize_context.py +26 -0
- murf-2.2.3/src/murf/types/set_voice_configuration_or_initialize_context_voice_config.py +57 -0
- murf-2.2.3/src/murf/types/set_voice_configuration_or_initialize_context_voice_config_pronunciation_dictionary_value.py +30 -0
- murf-2.2.3/src/murf/types/set_voice_configuration_or_initialize_context_voice_config_pronunciation_dictionary_value_type.py +7 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/source_locale_response.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/speech_to_speech_response.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/style_details.py +2 -2
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/translation.py +2 -2
- murf-2.2.3/src/murf/types/tts_request_both_payload.py +29 -0
- murf-2.2.3/src/murf/types/tts_request_both_payload_voice_config.py +44 -0
- murf-2.2.3/src/murf/types/tts_request_both_payload_voice_config_pronunciation_dictionary.py +22 -0
- murf-2.2.3/src/murf/types/tts_request_both_payload_voice_config_pronunciation_dictionary_guess.py +20 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/word_duration_response.py +2 -2
- murf-2.2.3/src/murf/voice_changer/__init__.py +2 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/voice_changer/client.py +29 -23
- murf-1.2.3/src/murf/environment.py +0 -7
- murf-1.2.3/src/murf/text_to_speech/__init__.py +0 -5
- murf-1.2.3/src/murf/text_to_speech/types/__init__.py +0 -5
- murf-1.2.3/src/murf/text_to_speech/types/generate_speech_request_model_version.py +0 -5
- murf-1.2.3/src/murf/types/__init__.py +0 -55
- {murf-1.2.3 → murf-2.2.3}/LICENSE +0 -0
- {murf-1.2.3 → murf-2.2.3}/README.md +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/auth/__init__.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/api_error.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/datetime_utils.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/file.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/jsonable_encoder.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/query_encoder.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/remove_none_from_dict.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/request_options.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/core/serialization.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/__init__.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/client.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/jobs/__init__.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/jobs/types/__init__.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/jobs/types/jobs_create_request_priority.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/jobs/types/jobs_create_with_project_id_request_priority.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/languages/__init__.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/projects/__init__.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/projects/types/__init__.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/dubbing/projects/types/api_create_project_request_dubbing_type.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/errors/__init__.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/errors/bad_request_error.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/errors/forbidden_error.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/errors/internal_server_error.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/errors/payment_required_error.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/errors/service_unavailable_error.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/errors/unauthorized_error.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/py.typed +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/text/__init__.py +0 -0
- {murf-1.2.3/src/murf/voice_changer → murf-2.2.3/src/murf/text_to_speech}/__init__.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/api_job_response_dubbing_type.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/api_job_response_priority.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/api_project_response_dubbing_type.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/api_voice_gender.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/locale_response_supports_item.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/types/pronunciation_detail_type.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/utils.py +0 -0
- {murf-1.2.3 → murf-2.2.3}/src/murf/version.py +0 -0
|
@@ -8,10 +8,13 @@ from .types import (
|
|
|
8
8
|
ApiProjectResponseDubbingType,
|
|
9
9
|
ApiVoice,
|
|
10
10
|
ApiVoiceGender,
|
|
11
|
+
AudioOutput,
|
|
11
12
|
AuthTokenResponse,
|
|
12
13
|
CharacterCount,
|
|
14
|
+
ClearContext,
|
|
13
15
|
DubApiDetailResponse,
|
|
14
16
|
DubJobStatusResponse,
|
|
17
|
+
FinalOutput,
|
|
15
18
|
FormDataContentDisposition,
|
|
16
19
|
GenerateSpeechResponse,
|
|
17
20
|
GroupApiProjectResponse,
|
|
@@ -21,10 +24,23 @@ from .types import (
|
|
|
21
24
|
MurfApiTranslationResponse,
|
|
22
25
|
PronunciationDetail,
|
|
23
26
|
PronunciationDetailType,
|
|
27
|
+
SendText,
|
|
28
|
+
SendTextVoiceConfig,
|
|
29
|
+
SendTextVoiceConfigPronunciationDictionaryValue,
|
|
30
|
+
SendTextVoiceConfigPronunciationDictionaryValueType,
|
|
31
|
+
SetAdvancedSettings,
|
|
32
|
+
SetVoiceConfigurationOrInitializeContext,
|
|
33
|
+
SetVoiceConfigurationOrInitializeContextVoiceConfig,
|
|
34
|
+
SetVoiceConfigurationOrInitializeContextVoiceConfigPronunciationDictionaryValue,
|
|
35
|
+
SetVoiceConfigurationOrInitializeContextVoiceConfigPronunciationDictionaryValueType,
|
|
24
36
|
SourceLocaleResponse,
|
|
25
37
|
SpeechToSpeechResponse,
|
|
26
38
|
StyleDetails,
|
|
27
39
|
Translation,
|
|
40
|
+
TtsRequestBothPayload,
|
|
41
|
+
TtsRequestBothPayloadVoiceConfig,
|
|
42
|
+
TtsRequestBothPayloadVoiceConfigPronunciationDictionary,
|
|
43
|
+
TtsRequestBothPayloadVoiceConfigPronunciationDictionaryGuess,
|
|
28
44
|
WordDurationResponse,
|
|
29
45
|
)
|
|
30
46
|
from .errors import (
|
|
@@ -35,11 +51,11 @@ from .errors import (
|
|
|
35
51
|
ServiceUnavailableError,
|
|
36
52
|
UnauthorizedError,
|
|
37
53
|
)
|
|
38
|
-
from . import auth, dubbing, text, text_to_speech, voice_changer
|
|
54
|
+
from . import auth, dubbing, stream_input, text, text_to_speech, voice_changer
|
|
39
55
|
from .client import AsyncMurf, Murf
|
|
40
56
|
from .dubbing_client import MurfDub
|
|
41
57
|
from .environment import MurfEnvironment
|
|
42
|
-
from .
|
|
58
|
+
from .stream_input import ReceiveMessage, SendMessage, TextToSpeechModel
|
|
43
59
|
from .version import __version__
|
|
44
60
|
|
|
45
61
|
__all__ = [
|
|
@@ -51,14 +67,16 @@ __all__ = [
|
|
|
51
67
|
"ApiVoice",
|
|
52
68
|
"ApiVoiceGender",
|
|
53
69
|
"AsyncMurf",
|
|
70
|
+
"AudioOutput",
|
|
54
71
|
"AuthTokenResponse",
|
|
55
72
|
"BadRequestError",
|
|
56
73
|
"CharacterCount",
|
|
74
|
+
"ClearContext",
|
|
57
75
|
"DubApiDetailResponse",
|
|
58
76
|
"DubJobStatusResponse",
|
|
77
|
+
"FinalOutput",
|
|
59
78
|
"ForbiddenError",
|
|
60
79
|
"FormDataContentDisposition",
|
|
61
|
-
"GenerateSpeechRequestModelVersion",
|
|
62
80
|
"GenerateSpeechResponse",
|
|
63
81
|
"GroupApiProjectResponse",
|
|
64
82
|
"InternalServerError",
|
|
@@ -72,16 +90,33 @@ __all__ = [
|
|
|
72
90
|
"PaymentRequiredError",
|
|
73
91
|
"PronunciationDetail",
|
|
74
92
|
"PronunciationDetailType",
|
|
93
|
+
"ReceiveMessage",
|
|
94
|
+
"SendMessage",
|
|
95
|
+
"SendText",
|
|
96
|
+
"SendTextVoiceConfig",
|
|
97
|
+
"SendTextVoiceConfigPronunciationDictionaryValue",
|
|
98
|
+
"SendTextVoiceConfigPronunciationDictionaryValueType",
|
|
75
99
|
"ServiceUnavailableError",
|
|
100
|
+
"SetAdvancedSettings",
|
|
101
|
+
"SetVoiceConfigurationOrInitializeContext",
|
|
102
|
+
"SetVoiceConfigurationOrInitializeContextVoiceConfig",
|
|
103
|
+
"SetVoiceConfigurationOrInitializeContextVoiceConfigPronunciationDictionaryValue",
|
|
104
|
+
"SetVoiceConfigurationOrInitializeContextVoiceConfigPronunciationDictionaryValueType",
|
|
76
105
|
"SourceLocaleResponse",
|
|
77
106
|
"SpeechToSpeechResponse",
|
|
78
107
|
"StyleDetails",
|
|
108
|
+
"TextToSpeechModel",
|
|
79
109
|
"Translation",
|
|
110
|
+
"TtsRequestBothPayload",
|
|
111
|
+
"TtsRequestBothPayloadVoiceConfig",
|
|
112
|
+
"TtsRequestBothPayloadVoiceConfigPronunciationDictionary",
|
|
113
|
+
"TtsRequestBothPayloadVoiceConfigPronunciationDictionaryGuess",
|
|
80
114
|
"UnauthorizedError",
|
|
81
115
|
"WordDurationResponse",
|
|
82
116
|
"__version__",
|
|
83
117
|
"auth",
|
|
84
118
|
"dubbing",
|
|
119
|
+
"stream_input",
|
|
85
120
|
"text",
|
|
86
121
|
"text_to_speech",
|
|
87
122
|
"voice_changer",
|
|
@@ -4,7 +4,7 @@ from ..core.client_wrapper import SyncClientWrapper
|
|
|
4
4
|
import typing
|
|
5
5
|
from ..core.request_options import RequestOptions
|
|
6
6
|
from ..types.auth_token_response import AuthTokenResponse
|
|
7
|
-
from ..core.
|
|
7
|
+
from ..core.unchecked_base_model import construct_type
|
|
8
8
|
from ..errors.bad_request_error import BadRequestError
|
|
9
9
|
from ..errors.unauthorized_error import UnauthorizedError
|
|
10
10
|
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
@@ -42,6 +42,7 @@ class AuthClient:
|
|
|
42
42
|
"""
|
|
43
43
|
_response = self._client_wrapper.httpx_client.request(
|
|
44
44
|
"v1/auth/token",
|
|
45
|
+
base_url=self._client_wrapper.get_environment().base,
|
|
45
46
|
method="GET",
|
|
46
47
|
request_options=request_options,
|
|
47
48
|
)
|
|
@@ -49,7 +50,7 @@ class AuthClient:
|
|
|
49
50
|
if 200 <= _response.status_code < 300:
|
|
50
51
|
return typing.cast(
|
|
51
52
|
AuthTokenResponse,
|
|
52
|
-
|
|
53
|
+
construct_type(
|
|
53
54
|
type_=AuthTokenResponse, # type: ignore
|
|
54
55
|
object_=_response.json(),
|
|
55
56
|
),
|
|
@@ -58,7 +59,7 @@ class AuthClient:
|
|
|
58
59
|
raise BadRequestError(
|
|
59
60
|
typing.cast(
|
|
60
61
|
typing.Optional[typing.Any],
|
|
61
|
-
|
|
62
|
+
construct_type(
|
|
62
63
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
63
64
|
object_=_response.json(),
|
|
64
65
|
),
|
|
@@ -68,7 +69,7 @@ class AuthClient:
|
|
|
68
69
|
raise UnauthorizedError(
|
|
69
70
|
typing.cast(
|
|
70
71
|
typing.Optional[typing.Any],
|
|
71
|
-
|
|
72
|
+
construct_type(
|
|
72
73
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
73
74
|
object_=_response.json(),
|
|
74
75
|
),
|
|
@@ -78,7 +79,7 @@ class AuthClient:
|
|
|
78
79
|
raise ServiceUnavailableError(
|
|
79
80
|
typing.cast(
|
|
80
81
|
typing.Optional[typing.Any],
|
|
81
|
-
|
|
82
|
+
construct_type(
|
|
82
83
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
83
84
|
object_=_response.json(),
|
|
84
85
|
),
|
|
@@ -127,6 +128,7 @@ class AsyncAuthClient:
|
|
|
127
128
|
"""
|
|
128
129
|
_response = await self._client_wrapper.httpx_client.request(
|
|
129
130
|
"v1/auth/token",
|
|
131
|
+
base_url=self._client_wrapper.get_environment().base,
|
|
130
132
|
method="GET",
|
|
131
133
|
request_options=request_options,
|
|
132
134
|
)
|
|
@@ -134,7 +136,7 @@ class AsyncAuthClient:
|
|
|
134
136
|
if 200 <= _response.status_code < 300:
|
|
135
137
|
return typing.cast(
|
|
136
138
|
AuthTokenResponse,
|
|
137
|
-
|
|
139
|
+
construct_type(
|
|
138
140
|
type_=AuthTokenResponse, # type: ignore
|
|
139
141
|
object_=_response.json(),
|
|
140
142
|
),
|
|
@@ -143,7 +145,7 @@ class AsyncAuthClient:
|
|
|
143
145
|
raise BadRequestError(
|
|
144
146
|
typing.cast(
|
|
145
147
|
typing.Optional[typing.Any],
|
|
146
|
-
|
|
148
|
+
construct_type(
|
|
147
149
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
148
150
|
object_=_response.json(),
|
|
149
151
|
),
|
|
@@ -153,7 +155,7 @@ class AsyncAuthClient:
|
|
|
153
155
|
raise UnauthorizedError(
|
|
154
156
|
typing.cast(
|
|
155
157
|
typing.Optional[typing.Any],
|
|
156
|
-
|
|
158
|
+
construct_type(
|
|
157
159
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
158
160
|
object_=_response.json(),
|
|
159
161
|
),
|
|
@@ -163,7 +165,7 @@ class AsyncAuthClient:
|
|
|
163
165
|
raise ServiceUnavailableError(
|
|
164
166
|
typing.cast(
|
|
165
167
|
typing.Optional[typing.Any],
|
|
166
|
-
|
|
168
|
+
construct_type(
|
|
167
169
|
type_=typing.Optional[typing.Any], # type: ignore
|
|
168
170
|
object_=_response.json(),
|
|
169
171
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import typing
|
|
4
3
|
from .environment import MurfEnvironment
|
|
4
|
+
import typing
|
|
5
5
|
import httpx
|
|
6
6
|
from .core.client_wrapper import SyncClientWrapper
|
|
7
7
|
from .auth.client import AuthClient
|
|
@@ -23,9 +23,6 @@ class BaseClient:
|
|
|
23
23
|
|
|
24
24
|
Parameters
|
|
25
25
|
----------
|
|
26
|
-
base_url : typing.Optional[str]
|
|
27
|
-
The base url to use for requests from the client.
|
|
28
|
-
|
|
29
26
|
environment : MurfEnvironment
|
|
30
27
|
The environment to use for requests from the client. from .environment import MurfEnvironment
|
|
31
28
|
|
|
@@ -57,7 +54,6 @@ class BaseClient:
|
|
|
57
54
|
def __init__(
|
|
58
55
|
self,
|
|
59
56
|
*,
|
|
60
|
-
base_url: typing.Optional[str] = None,
|
|
61
57
|
environment: MurfEnvironment = MurfEnvironment.DEFAULT,
|
|
62
58
|
api_key: typing.Optional[str] = None,
|
|
63
59
|
timeout: typing.Optional[float] = None,
|
|
@@ -66,7 +62,7 @@ class BaseClient:
|
|
|
66
62
|
):
|
|
67
63
|
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
68
64
|
self._client_wrapper = SyncClientWrapper(
|
|
69
|
-
|
|
65
|
+
environment=environment,
|
|
70
66
|
api_key=api_key,
|
|
71
67
|
httpx_client=httpx_client
|
|
72
68
|
if httpx_client is not None
|
|
@@ -88,9 +84,6 @@ class AsyncBaseClient:
|
|
|
88
84
|
|
|
89
85
|
Parameters
|
|
90
86
|
----------
|
|
91
|
-
base_url : typing.Optional[str]
|
|
92
|
-
The base url to use for requests from the client.
|
|
93
|
-
|
|
94
87
|
environment : MurfEnvironment
|
|
95
88
|
The environment to use for requests from the client. from .environment import MurfEnvironment
|
|
96
89
|
|
|
@@ -122,7 +115,6 @@ class AsyncBaseClient:
|
|
|
122
115
|
def __init__(
|
|
123
116
|
self,
|
|
124
117
|
*,
|
|
125
|
-
base_url: typing.Optional[str] = None,
|
|
126
118
|
environment: MurfEnvironment = MurfEnvironment.DEFAULT,
|
|
127
119
|
api_key: typing.Optional[str] = None,
|
|
128
120
|
timeout: typing.Optional[float] = None,
|
|
@@ -131,7 +123,7 @@ class AsyncBaseClient:
|
|
|
131
123
|
):
|
|
132
124
|
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
133
125
|
self._client_wrapper = AsyncClientWrapper(
|
|
134
|
-
|
|
126
|
+
environment=environment,
|
|
135
127
|
api_key=api_key,
|
|
136
128
|
httpx_client=httpx_client
|
|
137
129
|
if httpx_client is not None
|
|
@@ -145,12 +137,3 @@ class AsyncBaseClient:
|
|
|
145
137
|
self.text = AsyncTextClient(client_wrapper=self._client_wrapper)
|
|
146
138
|
self.voice_changer = AsyncVoiceChangerClient(client_wrapper=self._client_wrapper)
|
|
147
139
|
self.dubbing = AsyncDubbingClient(client_wrapper=self._client_wrapper)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: MurfEnvironment) -> str:
|
|
151
|
-
if base_url is not None:
|
|
152
|
-
return base_url
|
|
153
|
-
elif environment is not None:
|
|
154
|
-
return environment.value
|
|
155
|
-
else:
|
|
156
|
-
raise Exception("Please pass in either base_url or environment to construct the client")
|
|
@@ -11,8 +11,6 @@ class Murf(BaseClient):
|
|
|
11
11
|
|
|
12
12
|
Parameters
|
|
13
13
|
----------
|
|
14
|
-
base_url : typing.Optional[str]
|
|
15
|
-
The base url to use for requests from the client.
|
|
16
14
|
|
|
17
15
|
environment : MurfEnvironment
|
|
18
16
|
The environment to use for requests from the client. from .environment import MurfEnvironment
|
|
@@ -45,7 +43,6 @@ class Murf(BaseClient):
|
|
|
45
43
|
def __init__(
|
|
46
44
|
self,
|
|
47
45
|
*,
|
|
48
|
-
base_url: typing.Optional[str] = None,
|
|
49
46
|
environment: MurfEnvironment = MurfEnvironment.DEFAULT,
|
|
50
47
|
api_key: typing.Optional[str] = os.getenv("MURF_API_KEY"),
|
|
51
48
|
timeout: typing.Optional[float] = 60,
|
|
@@ -57,7 +54,6 @@ class Murf(BaseClient):
|
|
|
57
54
|
httpx_client=httpx_client if httpx_client is not None else httpx.Client(params=default_params, timeout=_defaulted_timeout, follow_redirects=follow_redirects) if follow_redirects is not None else httpx.Client(params=default_params, timeout=_defaulted_timeout)
|
|
58
55
|
|
|
59
56
|
super().__init__(
|
|
60
|
-
base_url=base_url,
|
|
61
57
|
environment=environment,
|
|
62
58
|
api_key=api_key,
|
|
63
59
|
timeout=timeout,
|
|
@@ -73,8 +69,6 @@ class AsyncMurf(AsyncBaseClient):
|
|
|
73
69
|
|
|
74
70
|
Parameters
|
|
75
71
|
----------
|
|
76
|
-
base_url : typing.Optional[str]
|
|
77
|
-
The base url to use for requests from the client.
|
|
78
72
|
|
|
79
73
|
environment : MurfEnvironment
|
|
80
74
|
The environment to use for requests from the client. from .environment import MurfEnvironment
|
|
@@ -107,7 +101,6 @@ class AsyncMurf(AsyncBaseClient):
|
|
|
107
101
|
def __init__(
|
|
108
102
|
self,
|
|
109
103
|
*,
|
|
110
|
-
base_url: typing.Optional[str] = None,
|
|
111
104
|
environment: MurfEnvironment = MurfEnvironment.DEFAULT,
|
|
112
105
|
api_key: typing.Optional[str] = os.getenv("MURF_API_KEY"),
|
|
113
106
|
timeout: typing.Optional[float] = 60,
|
|
@@ -119,7 +112,6 @@ class AsyncMurf(AsyncBaseClient):
|
|
|
119
112
|
httpx_client=httpx_client if httpx_client is not None else httpx.AsyncClient(params=default_params, timeout=_defaulted_timeout, follow_redirects=follow_redirects) if follow_redirects is not None else httpx.AsyncClient(params=default_params, timeout=_defaulted_timeout)
|
|
120
113
|
|
|
121
114
|
super().__init__(
|
|
122
|
-
base_url=base_url,
|
|
123
115
|
environment=environment,
|
|
124
116
|
api_key=api_key,
|
|
125
117
|
timeout=timeout,
|
|
@@ -19,6 +19,7 @@ from .query_encoder import encode_query
|
|
|
19
19
|
from .remove_none_from_dict import remove_none_from_dict
|
|
20
20
|
from .request_options import RequestOptions
|
|
21
21
|
from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
|
|
22
|
+
from .unchecked_base_model import UncheckedBaseModel, UnionMetadata, construct_type
|
|
22
23
|
|
|
23
24
|
__all__ = [
|
|
24
25
|
"ApiError",
|
|
@@ -31,8 +32,11 @@ __all__ = [
|
|
|
31
32
|
"IS_PYDANTIC_V2",
|
|
32
33
|
"RequestOptions",
|
|
33
34
|
"SyncClientWrapper",
|
|
35
|
+
"UncheckedBaseModel",
|
|
36
|
+
"UnionMetadata",
|
|
34
37
|
"UniversalBaseModel",
|
|
35
38
|
"UniversalRootModel",
|
|
39
|
+
"construct_type",
|
|
36
40
|
"convert_and_respect_annotation_metadata",
|
|
37
41
|
"convert_file_dict_to_httpx_tuples",
|
|
38
42
|
"encode_query",
|
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
+
from ..environment import MurfEnvironment
|
|
4
5
|
import httpx
|
|
5
6
|
from .http_client import HttpClient
|
|
6
7
|
from .http_client import AsyncHttpClient
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class BaseClientWrapper:
|
|
10
|
-
def __init__(
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
*,
|
|
14
|
+
api_key: typing.Optional[str] = None,
|
|
15
|
+
environment: MurfEnvironment,
|
|
16
|
+
timeout: typing.Optional[float] = None,
|
|
17
|
+
):
|
|
11
18
|
self._api_key = api_key
|
|
12
|
-
self.
|
|
19
|
+
self._environment = environment
|
|
13
20
|
self._timeout = timeout
|
|
14
21
|
|
|
15
22
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
16
23
|
headers: typing.Dict[str, str] = {
|
|
17
24
|
"X-Fern-Language": "Python",
|
|
18
25
|
"X-Fern-SDK-Name": "murf",
|
|
19
|
-
"X-Fern-SDK-Version": "
|
|
26
|
+
"X-Fern-SDK-Version": "2.2.3",
|
|
20
27
|
}
|
|
21
28
|
if self._api_key is not None:
|
|
22
29
|
headers["api-key"] = self._api_key
|
|
23
30
|
return headers
|
|
24
31
|
|
|
25
|
-
def
|
|
26
|
-
return self.
|
|
32
|
+
def get_environment(self) -> MurfEnvironment:
|
|
33
|
+
return self._environment
|
|
27
34
|
|
|
28
35
|
def get_timeout(self) -> typing.Optional[float]:
|
|
29
36
|
return self._timeout
|
|
@@ -34,16 +41,13 @@ class SyncClientWrapper(BaseClientWrapper):
|
|
|
34
41
|
self,
|
|
35
42
|
*,
|
|
36
43
|
api_key: typing.Optional[str] = None,
|
|
37
|
-
|
|
44
|
+
environment: MurfEnvironment,
|
|
38
45
|
timeout: typing.Optional[float] = None,
|
|
39
46
|
httpx_client: httpx.Client,
|
|
40
47
|
):
|
|
41
|
-
super().__init__(api_key=api_key,
|
|
48
|
+
super().__init__(api_key=api_key, environment=environment, timeout=timeout)
|
|
42
49
|
self.httpx_client = HttpClient(
|
|
43
|
-
httpx_client=httpx_client,
|
|
44
|
-
base_headers=self.get_headers,
|
|
45
|
-
base_timeout=self.get_timeout,
|
|
46
|
-
base_url=self.get_base_url,
|
|
50
|
+
httpx_client=httpx_client, base_headers=self.get_headers, base_timeout=self.get_timeout
|
|
47
51
|
)
|
|
48
52
|
|
|
49
53
|
|
|
@@ -52,14 +56,11 @@ class AsyncClientWrapper(BaseClientWrapper):
|
|
|
52
56
|
self,
|
|
53
57
|
*,
|
|
54
58
|
api_key: typing.Optional[str] = None,
|
|
55
|
-
|
|
59
|
+
environment: MurfEnvironment,
|
|
56
60
|
timeout: typing.Optional[float] = None,
|
|
57
61
|
httpx_client: httpx.AsyncClient,
|
|
58
62
|
):
|
|
59
|
-
super().__init__(api_key=api_key,
|
|
63
|
+
super().__init__(api_key=api_key, environment=environment, timeout=timeout)
|
|
60
64
|
self.httpx_client = AsyncHttpClient(
|
|
61
|
-
httpx_client=httpx_client,
|
|
62
|
-
base_headers=self.get_headers,
|
|
63
|
-
base_timeout=self.get_timeout,
|
|
64
|
-
base_url=self.get_base_url,
|
|
65
|
+
httpx_client=httpx_client, base_headers=self.get_headers, base_timeout=self.get_timeout
|
|
65
66
|
)
|
|
@@ -85,8 +85,8 @@ def _retry_timeout(response: httpx.Response, retries: int) -> float:
|
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
def _should_retry(response: httpx.Response) -> bool:
|
|
88
|
-
|
|
89
|
-
return response.status_code >= 500 or response.status_code in
|
|
88
|
+
retryable_400s = [429, 408, 409]
|
|
89
|
+
return response.status_code >= 500 or response.status_code in retryable_400s
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
def remove_omit_from_dict(
|
|
@@ -183,7 +183,7 @@ class HttpClient:
|
|
|
183
183
|
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
|
|
184
184
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
185
185
|
request_options: typing.Optional[RequestOptions] = None,
|
|
186
|
-
retries: int =
|
|
186
|
+
retries: int = 2,
|
|
187
187
|
omit: typing.Optional[typing.Any] = None,
|
|
188
188
|
) -> httpx.Response:
|
|
189
189
|
base_url = self.get_base_url(base_url)
|
|
@@ -269,7 +269,7 @@ class HttpClient:
|
|
|
269
269
|
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
|
|
270
270
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
271
271
|
request_options: typing.Optional[RequestOptions] = None,
|
|
272
|
-
retries: int =
|
|
272
|
+
retries: int = 2,
|
|
273
273
|
omit: typing.Optional[typing.Any] = None,
|
|
274
274
|
) -> typing.Iterator[httpx.Response]:
|
|
275
275
|
base_url = self.get_base_url(base_url)
|
|
@@ -359,7 +359,7 @@ class AsyncHttpClient:
|
|
|
359
359
|
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
|
|
360
360
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
361
361
|
request_options: typing.Optional[RequestOptions] = None,
|
|
362
|
-
retries: int =
|
|
362
|
+
retries: int = 2,
|
|
363
363
|
omit: typing.Optional[typing.Any] = None,
|
|
364
364
|
) -> httpx.Response:
|
|
365
365
|
base_url = self.get_base_url(base_url)
|
|
@@ -445,7 +445,7 @@ class AsyncHttpClient:
|
|
|
445
445
|
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
|
|
446
446
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
447
447
|
request_options: typing.Optional[RequestOptions] = None,
|
|
448
|
-
retries: int =
|
|
448
|
+
retries: int = 2,
|
|
449
449
|
omit: typing.Optional[typing.Any] = None,
|
|
450
450
|
) -> typing.AsyncIterator[httpx.Response]:
|
|
451
451
|
base_url = self.get_base_url(base_url)
|
|
@@ -79,7 +79,7 @@ def to_jsonable_with_fallback(
|
|
|
79
79
|
class UniversalBaseModel(pydantic.BaseModel):
|
|
80
80
|
if IS_PYDANTIC_V2:
|
|
81
81
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
82
|
-
# Allow fields
|
|
82
|
+
# Allow fields beginning with `model_` to be used in the model
|
|
83
83
|
protected_namespaces=(),
|
|
84
84
|
) # type: ignore # Pydantic v2
|
|
85
85
|
|
|
@@ -128,7 +128,7 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
|
128
128
|
Override the default dict method to `exclude_unset` by default. This function patches
|
|
129
129
|
`exclude_unset` to work include fields within non-None default values.
|
|
130
130
|
"""
|
|
131
|
-
# Note: the logic here is
|
|
131
|
+
# Note: the logic here is multiplexed given the levers exposed in Pydantic V1 vs V2
|
|
132
132
|
# Pydantic V1's .dict can be extremely slow, so we do not want to call it twice.
|
|
133
133
|
#
|
|
134
134
|
# We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models
|