murf 2.3.0__tar.gz → 2.4.1__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.
- murf-2.4.1/PKG-INFO +309 -0
- murf-2.4.1/README.md +277 -0
- murf-2.4.1/pyproject.toml +96 -0
- murf-2.4.1/src/murf/__init__.py +432 -0
- murf-2.4.1/src/murf/_default_clients.py +30 -0
- {murf-2.3.0/src/murf/dubbing/languages → murf-2.4.1/src/murf/auth}/__init__.py +2 -0
- murf-2.4.1/src/murf/auth/client.py +100 -0
- murf-2.3.0/src/murf/auth/client.py → murf-2.4.1/src/murf/auth/raw_client.py +67 -70
- murf-2.4.1/src/murf/base_client.py +325 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/client.py +2 -2
- murf-2.4.1/src/murf/core/__init__.py +134 -0
- murf-2.4.1/src/murf/core/api_error.py +23 -0
- murf-2.4.1/src/murf/core/client_wrapper.py +140 -0
- murf-2.4.1/src/murf/core/datetime_utils.py +70 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/core/file.py +31 -2
- murf-2.4.1/src/murf/core/force_multipart.py +18 -0
- murf-2.4.1/src/murf/core/http_client.py +1047 -0
- murf-2.4.1/src/murf/core/http_response.py +63 -0
- murf-2.4.1/src/murf/core/http_sse/__init__.py +42 -0
- murf-2.4.1/src/murf/core/http_sse/_api.py +480 -0
- murf-2.4.1/src/murf/core/http_sse/_decoders.py +99 -0
- murf-2.4.1/src/murf/core/http_sse/_exceptions.py +32 -0
- murf-2.4.1/src/murf/core/http_sse/_models.py +42 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/core/jsonable_encoder.py +70 -1
- murf-2.4.1/src/murf/core/logging.py +107 -0
- murf-2.4.1/src/murf/core/parse_error.py +36 -0
- murf-2.4.1/src/murf/core/pydantic_utilities.py +540 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/core/request_options.py +9 -1
- {murf-2.3.0 → murf-2.4.1}/src/murf/core/serialization.py +80 -5
- murf-2.4.1/src/murf/core/unchecked_base_model.py +505 -0
- murf-2.4.1/src/murf/dubbing/__init__.py +50 -0
- murf-2.4.1/src/murf/dubbing/client.py +101 -0
- murf-2.4.1/src/murf/dubbing/jobs/__init__.py +37 -0
- murf-2.4.1/src/murf/dubbing/jobs/client.py +393 -0
- murf-2.3.0/src/murf/dubbing/jobs/client.py → murf-2.4.1/src/murf/dubbing/jobs/raw_client.py +205 -234
- murf-2.4.1/src/murf/dubbing/jobs/types/__init__.py +38 -0
- {murf-2.3.0/src/murf/auth → murf-2.4.1/src/murf/dubbing/languages}/__init__.py +2 -0
- murf-2.4.1/src/murf/dubbing/languages/client.py +161 -0
- murf-2.3.0/src/murf/dubbing/languages/client.py → murf-2.4.1/src/murf/dubbing/languages/raw_client.py +130 -143
- murf-2.4.1/src/murf/dubbing/projects/__init__.py +34 -0
- murf-2.4.1/src/murf/dubbing/projects/client.py +339 -0
- murf-2.3.0/src/murf/dubbing/projects/client.py → murf-2.4.1/src/murf/dubbing/projects/raw_client.py +194 -235
- murf-2.4.1/src/murf/dubbing/projects/types/__init__.py +36 -0
- murf-2.4.1/src/murf/dubbing/raw_client.py +13 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/dubbing_client.py +2 -2
- {murf-2.3.0 → murf-2.4.1}/src/murf/environment.py +6 -0
- murf-2.4.1/src/murf/errors/__init__.py +68 -0
- murf-2.4.1/src/murf/errors/bad_request_error.py +10 -0
- murf-2.4.1/src/murf/errors/content_too_large_error.py +10 -0
- murf-2.4.1/src/murf/errors/forbidden_error.py +10 -0
- murf-2.4.1/src/murf/errors/gateway_timeout_error.py +10 -0
- murf-2.4.1/src/murf/errors/internal_server_error.py +10 -0
- murf-2.4.1/src/murf/errors/not_found_error.py +10 -0
- murf-2.4.1/src/murf/errors/payment_required_error.py +10 -0
- murf-2.4.1/src/murf/errors/service_unavailable_error.py +10 -0
- murf-2.4.1/src/murf/errors/too_many_requests_error.py +10 -0
- murf-2.4.1/src/murf/errors/unauthorized_error.py +10 -0
- murf-2.4.1/src/murf/errors/unprocessable_entity_error.py +10 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/region.py +36 -12
- murf-2.4.1/src/murf/speech_to_text/__init__.py +49 -0
- murf-2.4.1/src/murf/speech_to_text/client.py +355 -0
- murf-2.4.1/src/murf/speech_to_text/raw_client.py +631 -0
- murf-2.4.1/src/murf/speech_to_text/types/__init__.py +47 -0
- murf-2.4.1/src/murf/speech_to_text/types/create_transcription_request_mode.py +5 -0
- murf-2.4.1/src/murf/speech_to_text/types/create_transcription_request_model.py +5 -0
- murf-2.4.1/src/murf/speech_to_text/types/create_transcription_request_model_id.py +5 -0
- murf-2.4.1/src/murf/speech_to_text/types/create_transcription_request_timestamps_granularity.py +5 -0
- murf-2.4.1/src/murf/stream_input/__init__.py +34 -0
- murf-2.4.1/src/murf/stream_input/types/__init__.py +35 -0
- murf-2.4.1/src/murf/stream_input/types/receive_message.py +11 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/stream_input/types/send_message.py +3 -2
- {murf-2.3.0 → murf-2.4.1}/src/murf/text/__init__.py +2 -0
- murf-2.4.1/src/murf/text/client.py +139 -0
- murf-2.3.0/src/murf/text/client.py → murf-2.4.1/src/murf/text/raw_client.py +89 -90
- {murf-2.3.0 → murf-2.4.1}/src/murf/text_to_speech/__init__.py +2 -0
- murf-2.4.1/src/murf/text_to_speech/client.py +702 -0
- murf-2.3.0/src/murf/text_to_speech/client.py → murf-2.4.1/src/murf/text_to_speech/raw_client.py +412 -371
- murf-2.4.1/src/murf/types/__init__.py +332 -0
- murf-2.4.1/src/murf/types/alpha.py +6 -0
- murf-2.4.1/src/murf/types/api_cloned_voice.py +56 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/api_job_response.py +4 -3
- murf-2.4.1/src/murf/types/api_key.py +6 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/api_project_response.py +4 -3
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/api_voice.py +27 -10
- murf-2.4.1/src/murf/types/audio.py +6 -0
- murf-2.4.1/src/murf/types/audio_output.py +37 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/auth_token_response.py +11 -5
- murf-2.4.1/src/murf/types/bvc.py +6 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/character_count.py +3 -2
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/clear_context.py +3 -2
- murf-2.3.0/src/murf/types/set_advanced_settings.py → murf-2.4.1/src/murf/types/close_stream.py +5 -5
- murf-2.3.0/src/murf/stream_input/types/text_to_speech_model.py → murf-2.4.1/src/murf/types/commit_mode.py +1 -1
- murf-2.4.1/src/murf/types/common_base_response.py +42 -0
- murf-2.4.1/src/murf/types/create_voice_clone_response.py +47 -0
- murf-2.4.1/src/murf/types/diarize.py +6 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/dub_api_detail_response.py +3 -2
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/dub_job_status_response.py +3 -2
- murf-2.3.0/src/murf/types/audio_output.py → murf-2.4.1/src/murf/types/error.py +7 -10
- murf-2.4.1/src/murf/types/error_output.py +45 -0
- murf-2.4.1/src/murf/types/error_output_error_code.py +7 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/final_output.py +10 -4
- murf-2.4.1/src/murf/types/final_transcript.py +31 -0
- murf-2.4.1/src/murf/types/finalize.py +20 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/form_data_content_disposition.py +15 -8
- murf-2.4.1/src/murf/types/generate_speech_response.py +57 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/group_api_project_response.py +3 -2
- murf-2.4.1/src/murf/types/keep_alive.py +20 -0
- murf-2.4.1/src/murf/types/keywords.py +6 -0
- murf-2.4.1/src/murf/types/language.py +9 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/locale_response.py +3 -2
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/metadata.py +4 -3
- murf-2.4.1/src/murf/types/mode.py +8 -0
- murf-2.4.1/src/murf/types/model.py +5 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/murf_api_translation_response.py +4 -3
- murf-2.4.1/src/murf/types/partial_transcript.py +31 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/pronunciation_detail.py +5 -8
- murf-2.4.1/src/murf/types/quota_warning.py +24 -0
- murf-2.4.1/src/murf/types/raw_event_final.py +82 -0
- murf-2.4.1/src/murf/types/raw_event_final_trigger.py +5 -0
- murf-2.4.1/src/murf/types/raw_event_partial.py +75 -0
- murf-2.4.1/src/murf/types/raw_event_partial_event.py +5 -0
- murf-2.4.1/src/murf/types/send_text.py +41 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/send_text_voice_config.py +13 -17
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/send_text_voice_config_pronunciation_dictionary_value.py +4 -3
- murf-2.4.1/src/murf/types/session_started.py +86 -0
- murf-2.4.1/src/murf/types/session_started_commit_mode.py +5 -0
- murf-2.4.1/src/murf/types/session_started_commit_strategy.py +5 -0
- murf-2.4.1/src/murf/types/set_advanced_settings.py +59 -0
- murf-2.4.1/src/murf/types/set_advanced_settings_predictive_chunking.py +5 -0
- murf-2.4.1/src/murf/types/set_audio_configuration.py +43 -0
- murf-2.4.1/src/murf/types/set_audio_configuration_codec.py +7 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/set_voice_configuration_or_initialize_context.py +13 -4
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/set_voice_configuration_or_initialize_context_voice_config.py +13 -17
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/set_voice_configuration_or_initialize_context_voice_config_pronunciation_dictionary_value.py +4 -3
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/source_locale_response.py +3 -2
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/speech_to_speech_response.py +3 -2
- murf-2.4.1/src/murf/types/speech_to_text_sync_response.py +24 -0
- murf-2.4.1/src/murf/types/speech_to_text_transcript.py +52 -0
- murf-2.4.1/src/murf/types/speech_to_text_utterance.py +38 -0
- murf-2.4.1/src/murf/types/speech_to_text_word.py +36 -0
- murf-2.4.1/src/murf/types/speech_to_text_word_type.py +5 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/style_details.py +8 -5
- murf-2.4.1/src/murf/types/text_formatting.py +6 -0
- murf-2.4.1/src/murf/types/timestamp_output.py +44 -0
- murf-2.3.0/src/murf/types/tts_request_both_payload.py → murf-2.4.1/src/murf/types/timestamp_output_timestamps.py +8 -9
- murf-2.4.1/src/murf/types/transcription_accepted.py +22 -0
- murf-2.4.1/src/murf/types/transcription_job.py +32 -0
- murf-2.4.1/src/murf/types/transcription_job_error.py +22 -0
- murf-2.4.1/src/murf/types/transcription_job_error_code.py +7 -0
- murf-2.4.1/src/murf/types/transcription_job_status.py +5 -0
- murf-2.4.1/src/murf/types/transcription_warning.py +31 -0
- murf-2.4.1/src/murf/types/transcription_warning_code.py +5 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/translation.py +3 -2
- murf-2.4.1/src/murf/types/tts_request_both_payload.py +33 -0
- murf-2.4.1/src/murf/types/tts_request_both_payload_voice_config.py +55 -0
- murf-2.3.0/src/murf/types/tts_request_both_payload_voice_config_pronunciation_dictionary.py → murf-2.4.1/src/murf/types/tts_request_both_payload_voice_config_pronunciation_dictionary_value.py +16 -7
- murf-2.4.1/src/murf/types/tts_request_both_payload_voice_config_pronunciation_dictionary_value_type.py +7 -0
- murf-2.4.1/src/murf/types/voice_clone_creation_status_response.py +96 -0
- murf-2.4.1/src/murf/types/voice_clone_creation_status_response_status.py +7 -0
- murf-2.3.0/src/murf/types/send_text.py → murf-2.4.1/src/murf/types/warning_output.py +14 -10
- murf-2.4.1/src/murf/types/warning_output_warning_code.py +16 -0
- murf-2.4.1/src/murf/types/word.py +48 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/word_duration_response.py +23 -12
- murf-2.4.1/src/murf/types/word_timestamp.py +46 -0
- murf-2.4.1/src/murf/types/zero_retention.py +6 -0
- murf-2.4.1/src/murf/v_1_transcription_stream_input/__init__.py +37 -0
- murf-2.4.1/src/murf/v_1_transcription_stream_input/types/__init__.py +38 -0
- murf-2.4.1/src/murf/v_1_transcription_stream_input/types/receive_transcription_messages.py +11 -0
- murf-2.4.1/src/murf/v_1_transcription_stream_input/types/send_transcription_messages.py +11 -0
- murf-2.4.1/src/murf/voice_changer/__init__.py +4 -0
- murf-2.4.1/src/murf/voice_changer/client.py +302 -0
- murf-2.3.0/src/murf/voice_changer/client.py → murf-2.4.1/src/murf/voice_changer/raw_client.py +103 -114
- murf-2.4.1/src/murf/voice_cloning/__init__.py +4 -0
- murf-2.4.1/src/murf/voice_cloning/client.py +416 -0
- murf-2.4.1/src/murf/voice_cloning/raw_client.py +860 -0
- murf-2.3.0/PKG-INFO +0 -221
- murf-2.3.0/README.md +0 -194
- murf-2.3.0/pyproject.toml +0 -64
- murf-2.3.0/src/murf/__init__.py +0 -125
- murf-2.3.0/src/murf/base_client.py +0 -139
- murf-2.3.0/src/murf/core/__init__.py +0 -51
- murf-2.3.0/src/murf/core/api_error.py +0 -15
- murf-2.3.0/src/murf/core/client_wrapper.py +0 -66
- murf-2.3.0/src/murf/core/datetime_utils.py +0 -28
- murf-2.3.0/src/murf/core/http_client.py +0 -499
- murf-2.3.0/src/murf/core/pydantic_utilities.py +0 -296
- murf-2.3.0/src/murf/core/unchecked_base_model.py +0 -305
- murf-2.3.0/src/murf/dubbing/__init__.py +0 -14
- murf-2.3.0/src/murf/dubbing/client.py +0 -26
- murf-2.3.0/src/murf/dubbing/jobs/__init__.py +0 -5
- murf-2.3.0/src/murf/dubbing/jobs/types/__init__.py +0 -6
- murf-2.3.0/src/murf/dubbing/projects/__init__.py +0 -5
- murf-2.3.0/src/murf/dubbing/projects/types/__init__.py +0 -5
- murf-2.3.0/src/murf/errors/__init__.py +0 -17
- murf-2.3.0/src/murf/errors/bad_request_error.py +0 -9
- murf-2.3.0/src/murf/errors/forbidden_error.py +0 -9
- murf-2.3.0/src/murf/errors/internal_server_error.py +0 -9
- murf-2.3.0/src/murf/errors/payment_required_error.py +0 -9
- murf-2.3.0/src/murf/errors/service_unavailable_error.py +0 -9
- murf-2.3.0/src/murf/errors/unauthorized_error.py +0 -9
- murf-2.3.0/src/murf/stream_input/__init__.py +0 -5
- murf-2.3.0/src/murf/stream_input/types/__init__.py +0 -7
- murf-2.3.0/src/murf/stream_input/types/receive_message.py +0 -7
- murf-2.3.0/src/murf/types/__init__.py +0 -99
- murf-2.3.0/src/murf/types/generate_speech_response.py +0 -40
- murf-2.3.0/src/murf/types/tts_request_both_payload_voice_config.py +0 -44
- murf-2.3.0/src/murf/types/tts_request_both_payload_voice_config_pronunciation_dictionary_guess.py +0 -20
- murf-2.3.0/src/murf/voice_changer/__init__.py +0 -2
- {murf-2.3.0 → murf-2.4.1}/LICENSE +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/core/query_encoder.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/core/remove_none_from_dict.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/dubbing/jobs/types/jobs_create_request_priority.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/dubbing/jobs/types/jobs_create_with_project_id_request_priority.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/dubbing/projects/types/api_create_project_request_dubbing_type.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/py.typed +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/api_job_response_dubbing_type.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/api_job_response_priority.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/api_project_response_dubbing_type.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/api_voice_gender.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/locale_response_supports_item.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/pronunciation_detail_type.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/send_text_voice_config_pronunciation_dictionary_value_type.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/types/set_voice_configuration_or_initialize_context_voice_config_pronunciation_dictionary_value_type.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/utils.py +0 -0
- {murf-2.3.0 → murf-2.4.1}/src/murf/version.py +0 -0
murf-2.4.1/PKG-INFO
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: murf
|
|
3
|
+
Version: 2.4.1
|
|
4
|
+
Summary:
|
|
5
|
+
Requires-Python: >=3.10,<4.0
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Operating System :: MacOS
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Operating System :: POSIX
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Provides-Extra: aiohttp
|
|
23
|
+
Requires-Dist: aiohttp (>=3.14.1,<4) ; (python_version >= "3.10") and (extra == "aiohttp")
|
|
24
|
+
Requires-Dist: httpx (>=0.21.2)
|
|
25
|
+
Requires-Dist: httpx-aiohttp (>=0.1.8,<0.2.0) ; (python_version >= "3.10") and (extra == "aiohttp")
|
|
26
|
+
Requires-Dist: pydantic (>=1.9.2)
|
|
27
|
+
Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
|
|
28
|
+
Requires-Dist: typing_extensions (>=4.0.0)
|
|
29
|
+
Project-URL: Repository, https://github.com/murf-ai/murf-python-sdk
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# Murf Python SDK
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fmurf-ai%2Fmurf-python-sdk)
|
|
37
|
+
[](https://pypi.python.org/pypi/murf)
|
|
38
|
+
[](https://colab.research.google.com/gist/devgeetech-murf/bbe2c7eb01433f4a151f0fd2be23b1c8/murf-python-sdk.ipynb)
|
|
39
|
+
|
|
40
|
+
## Table of Contents
|
|
41
|
+
|
|
42
|
+
- [Overview](#overview)
|
|
43
|
+
- [Installation](#installation)
|
|
44
|
+
- [Getting Started](#getting-started)
|
|
45
|
+
- [Streaming (Falcon 2.1)](#streaming-falcon-21)
|
|
46
|
+
- [Synthesize (Gen 2)](#synthesize-gen-2)
|
|
47
|
+
- [List Voices](#list-voices)
|
|
48
|
+
- [Features](#features)
|
|
49
|
+
- [Asynchronous Usage](#async-client)
|
|
50
|
+
- [Exception Handling](#exception-handling)
|
|
51
|
+
- [Advanced Configuration](#advanced)
|
|
52
|
+
- [Contributing](#contributing)
|
|
53
|
+
- [License](#license)
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Overview
|
|
58
|
+
|
|
59
|
+
The Murf Python SDK integrates with the [Murf API](https://murf.ai/api/docs/introduction/overview) for [text-to-speech](https://murf.ai/text-to-speech). Murf offers two TTS models:
|
|
60
|
+
|
|
61
|
+
- **Streaming ([Falcon 2.1](https://murf.ai/api/docs/text-to-speech-models/falcon-2-1)):** Real-time, low-latency speech for conversational AI and voice agents (time-to-first-audio under 100ms). Use `client.text_to_speech.stream(...)`.
|
|
62
|
+
- **Synthesize ([Gen 2](https://murf.ai/api/docs/text-to-speech-models/gen-2)):** Studio-quality voiceover files with styles, pauses, duration, and variation. Use `client.text_to_speech.generate(...)`. Gen 2 is not available for streaming.
|
|
63
|
+
|
|
64
|
+
Together they cover 150+ voices across 35 languages. Each model has its own catalog; see the [Voice Library](https://murf.ai/api/docs/voices-styles/voice-library). The SDK supports both synchronous and asynchronous clients.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
Check out the [HTTP API documentation](https://murf.ai/api/docs/introduction/quickstart).
|
|
71
|
+
|
|
72
|
+
Install the SDK using pip. Streaming playback also needs `pyaudio`, which depends on PortAudio (`brew install portaudio` on macOS):
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install murf pyaudio
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Getting Started
|
|
81
|
+
|
|
82
|
+
Use [Streaming (Falcon 2.1)](https://murf.ai/api/docs/text-to-speech/streaming) for real-time voice agents, or [Synthesize (Gen 2)](https://murf.ai/api/docs/text-to-speech/synthesize) for a studio voiceover file. See the [Quickstart](https://murf.ai/api/docs/introduction/quickstart) and [TTS overview](https://murf.ai/api/docs/text-to-speech/overview).
|
|
83
|
+
|
|
84
|
+
### Streaming (Falcon 2.1)
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import pyaudio
|
|
88
|
+
from murf import Murf, MurfRegion
|
|
89
|
+
|
|
90
|
+
client = Murf(
|
|
91
|
+
api_key="YOUR_API_KEY", # Not required if you have set the MURF_API_KEY environment variable
|
|
92
|
+
region=MurfRegion.GLOBAL
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# For lower latency, specify a region closer to your users
|
|
96
|
+
# client = Murf(region=MurfRegion.IN) # Example: India region
|
|
97
|
+
|
|
98
|
+
# Audio format settings (must match your API output)
|
|
99
|
+
SAMPLE_RATE = 24000
|
|
100
|
+
CHANNELS = 1
|
|
101
|
+
FORMAT = pyaudio.paInt16
|
|
102
|
+
|
|
103
|
+
def play_streaming_audio():
|
|
104
|
+
# Get the streaming audio generator
|
|
105
|
+
audio_stream = client.text_to_speech.stream(
|
|
106
|
+
text="Hi, How are you doing today?",
|
|
107
|
+
voice_id="Gordon",
|
|
108
|
+
model="falcon-2.1",
|
|
109
|
+
locale="en-US",
|
|
110
|
+
sample_rate=SAMPLE_RATE,
|
|
111
|
+
format="PCM"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
# Setup audio stream for playback
|
|
115
|
+
pa = pyaudio.PyAudio()
|
|
116
|
+
stream = pa.open(format=FORMAT, channels=CHANNELS, rate=SAMPLE_RATE, output=True)
|
|
117
|
+
|
|
118
|
+
try:
|
|
119
|
+
print("Starting audio playback...")
|
|
120
|
+
for chunk in audio_stream:
|
|
121
|
+
if chunk: # Check if chunk has data
|
|
122
|
+
stream.write(chunk)
|
|
123
|
+
except Exception as e:
|
|
124
|
+
print(f"Error during streaming: {e}")
|
|
125
|
+
finally:
|
|
126
|
+
stream.stop_stream()
|
|
127
|
+
stream.close()
|
|
128
|
+
pa.terminate()
|
|
129
|
+
print("Audio streaming and playback complete!")
|
|
130
|
+
|
|
131
|
+
if __name__ == "__main__":
|
|
132
|
+
play_streaming_audio()
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
See [HTTP streaming](https://murf.ai/api/docs/text-to-speech/streaming) for regions, formats, and WebSocket streaming.
|
|
136
|
+
|
|
137
|
+
### Synthesize (Gen 2)
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from murf import Murf
|
|
141
|
+
|
|
142
|
+
client = Murf(
|
|
143
|
+
api_key="YOUR_API_KEY", # Not required if MURF_API_KEY is set
|
|
144
|
+
)
|
|
145
|
+
res = client.text_to_speech.generate(
|
|
146
|
+
text="There is much to be said",
|
|
147
|
+
voice_id="Terrell",
|
|
148
|
+
locale="en-US",
|
|
149
|
+
)
|
|
150
|
+
print(res.audio_file)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The response includes a URL to the generated audio file. The file is available for download for 72 hours. See [Synthesize](https://murf.ai/api/docs/text-to-speech/synthesize).
|
|
154
|
+
|
|
155
|
+
### List Voices
|
|
156
|
+
|
|
157
|
+
Each model has its own voice catalog. Pass `model` when listing voices: `falcon-2.1` for streaming, `gen2` for synthesis.
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
from murf import Murf
|
|
161
|
+
|
|
162
|
+
client = Murf(api_key="YOUR_API_KEY")
|
|
163
|
+
streaming_voices = client.text_to_speech.get_voices(model="falcon-2.1")
|
|
164
|
+
studio_voices = client.text_to_speech.get_voices(model="gen2")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
See [List Voices](https://murf.ai/api/docs/api-reference/voices/get-voices) and the [Voice Library](https://murf.ai/api/docs/voices-styles/voice-library).
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Features
|
|
172
|
+
|
|
173
|
+
- **Streaming (Falcon 2.1):** Real-time speech for voice agents and conversational AI. See [Falcon 2.1](https://murf.ai/api/docs/text-to-speech-models/falcon-2-1) and [HTTP streaming](https://murf.ai/api/docs/text-to-speech/streaming).
|
|
174
|
+
- **Synthesize (Gen 2):** Studio-quality voiceover files with styles, pauses, duration, and variation. See [Gen 2](https://murf.ai/api/docs/text-to-speech-models/gen-2) and [Synthesize](https://murf.ai/api/docs/text-to-speech/synthesize).
|
|
175
|
+
- **Model-specific voice catalogs:** Fetch streaming voices with `get_voices(model="falcon-2.1")` and studio voices with `get_voices(model="gen2")`. See [List Voices](https://murf.ai/api/docs/api-reference/voices/get-voices) and the [Voice Library](https://murf.ai/api/docs/voices-styles/voice-library).
|
|
176
|
+
- **150+ voices across 35 languages** and 20+ speaking styles.
|
|
177
|
+
|
|
178
|
+

|
|
179
|
+
|
|
180
|
+
- **Voice customization:** Adjust pitch, rate, locale, and pronunciation. Styles, pauses, duration, and variation are available on Synthesize (Gen 2).
|
|
181
|
+
- **Multiple audio formats:** MP3, WAV, FLAC, PCM, and others, with configurable sample rates.
|
|
182
|
+
- **Sync and async clients:** Blocking calls with `Murf`, or non-blocking calls with `AsyncMurf`.
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Async Client
|
|
188
|
+
|
|
189
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
import asyncio
|
|
193
|
+
from murf import AsyncMurf, MurfRegion
|
|
194
|
+
|
|
195
|
+
client = AsyncMurf(
|
|
196
|
+
api_key="YOUR_API_KEY",
|
|
197
|
+
region=MurfRegion.GLOBAL,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
async def main() -> None:
|
|
202
|
+
audio_stream = client.text_to_speech.stream(
|
|
203
|
+
text="Hi, How are you doing today?",
|
|
204
|
+
voice_id="Gordon",
|
|
205
|
+
model="falcon-2.1",
|
|
206
|
+
locale="en-US",
|
|
207
|
+
sample_rate=24000,
|
|
208
|
+
format="PCM",
|
|
209
|
+
)
|
|
210
|
+
async for chunk in audio_stream:
|
|
211
|
+
if chunk:
|
|
212
|
+
pass
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
asyncio.run(main())
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Exception Handling
|
|
221
|
+
|
|
222
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
223
|
+
will be thrown.
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
from murf.core.api_error import ApiError
|
|
227
|
+
|
|
228
|
+
try:
|
|
229
|
+
client.text_to_speech.generate(...)
|
|
230
|
+
except ApiError as e:
|
|
231
|
+
print(e.status_code)
|
|
232
|
+
print(e.body)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Advanced
|
|
238
|
+
|
|
239
|
+
### Retries
|
|
240
|
+
|
|
241
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
242
|
+
as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
|
|
243
|
+
retry limit (default: 2).
|
|
244
|
+
|
|
245
|
+
A request is deemed retriable when any of the following HTTP status codes is returned:
|
|
246
|
+
|
|
247
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
248
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
249
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
250
|
+
|
|
251
|
+
Use the `max_retries` request option to configure this behavior.
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
client.text_to_speech.generate(..., request_options={
|
|
255
|
+
"max_retries": 1
|
|
256
|
+
})
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Timeouts
|
|
260
|
+
|
|
261
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
262
|
+
|
|
263
|
+
```python
|
|
264
|
+
|
|
265
|
+
from murf import Murf
|
|
266
|
+
|
|
267
|
+
client = Murf(
|
|
268
|
+
...,
|
|
269
|
+
timeout=20.0,
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
# Override timeout for a specific method
|
|
274
|
+
client.text_to_speech.generate(..., request_options={
|
|
275
|
+
"timeout_in_seconds": 1
|
|
276
|
+
})
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Custom Client
|
|
280
|
+
|
|
281
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
282
|
+
and transports.
|
|
283
|
+
```python
|
|
284
|
+
import httpx
|
|
285
|
+
from murf import Murf
|
|
286
|
+
|
|
287
|
+
client = Murf(
|
|
288
|
+
...,
|
|
289
|
+
httpx_client=httpx.Client(
|
|
290
|
+
proxies="http://my.test.proxy.example.com",
|
|
291
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
292
|
+
),
|
|
293
|
+
)
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Contributing
|
|
299
|
+
|
|
300
|
+
We welcome contributions to enhance the Murf Python SDK. Please note that this library is generated programmatically, so direct modifications may be overwritten. We suggest opening an issue first to discuss your ideas or improvements. Contributions to the documentation are especially appreciated! For any support queries email to support@murf.ai
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## License
|
|
305
|
+
|
|
306
|
+
Murf Python SDK is released under the [MIT License](LICENSE).
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
murf-2.4.1/README.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Murf Python SDK
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fmurf-ai%2Fmurf-python-sdk)
|
|
6
|
+
[](https://pypi.python.org/pypi/murf)
|
|
7
|
+
[](https://colab.research.google.com/gist/devgeetech-murf/bbe2c7eb01433f4a151f0fd2be23b1c8/murf-python-sdk.ipynb)
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Overview](#overview)
|
|
12
|
+
- [Installation](#installation)
|
|
13
|
+
- [Getting Started](#getting-started)
|
|
14
|
+
- [Streaming (Falcon 2.1)](#streaming-falcon-21)
|
|
15
|
+
- [Synthesize (Gen 2)](#synthesize-gen-2)
|
|
16
|
+
- [List Voices](#list-voices)
|
|
17
|
+
- [Features](#features)
|
|
18
|
+
- [Asynchronous Usage](#async-client)
|
|
19
|
+
- [Exception Handling](#exception-handling)
|
|
20
|
+
- [Advanced Configuration](#advanced)
|
|
21
|
+
- [Contributing](#contributing)
|
|
22
|
+
- [License](#license)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Overview
|
|
27
|
+
|
|
28
|
+
The Murf Python SDK integrates with the [Murf API](https://murf.ai/api/docs/introduction/overview) for [text-to-speech](https://murf.ai/text-to-speech). Murf offers two TTS models:
|
|
29
|
+
|
|
30
|
+
- **Streaming ([Falcon 2.1](https://murf.ai/api/docs/text-to-speech-models/falcon-2-1)):** Real-time, low-latency speech for conversational AI and voice agents (time-to-first-audio under 100ms). Use `client.text_to_speech.stream(...)`.
|
|
31
|
+
- **Synthesize ([Gen 2](https://murf.ai/api/docs/text-to-speech-models/gen-2)):** Studio-quality voiceover files with styles, pauses, duration, and variation. Use `client.text_to_speech.generate(...)`. Gen 2 is not available for streaming.
|
|
32
|
+
|
|
33
|
+
Together they cover 150+ voices across 35 languages. Each model has its own catalog; see the [Voice Library](https://murf.ai/api/docs/voices-styles/voice-library). The SDK supports both synchronous and asynchronous clients.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
Check out the [HTTP API documentation](https://murf.ai/api/docs/introduction/quickstart).
|
|
40
|
+
|
|
41
|
+
Install the SDK using pip. Streaming playback also needs `pyaudio`, which depends on PortAudio (`brew install portaudio` on macOS):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install murf pyaudio
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Getting Started
|
|
50
|
+
|
|
51
|
+
Use [Streaming (Falcon 2.1)](https://murf.ai/api/docs/text-to-speech/streaming) for real-time voice agents, or [Synthesize (Gen 2)](https://murf.ai/api/docs/text-to-speech/synthesize) for a studio voiceover file. See the [Quickstart](https://murf.ai/api/docs/introduction/quickstart) and [TTS overview](https://murf.ai/api/docs/text-to-speech/overview).
|
|
52
|
+
|
|
53
|
+
### Streaming (Falcon 2.1)
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import pyaudio
|
|
57
|
+
from murf import Murf, MurfRegion
|
|
58
|
+
|
|
59
|
+
client = Murf(
|
|
60
|
+
api_key="YOUR_API_KEY", # Not required if you have set the MURF_API_KEY environment variable
|
|
61
|
+
region=MurfRegion.GLOBAL
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# For lower latency, specify a region closer to your users
|
|
65
|
+
# client = Murf(region=MurfRegion.IN) # Example: India region
|
|
66
|
+
|
|
67
|
+
# Audio format settings (must match your API output)
|
|
68
|
+
SAMPLE_RATE = 24000
|
|
69
|
+
CHANNELS = 1
|
|
70
|
+
FORMAT = pyaudio.paInt16
|
|
71
|
+
|
|
72
|
+
def play_streaming_audio():
|
|
73
|
+
# Get the streaming audio generator
|
|
74
|
+
audio_stream = client.text_to_speech.stream(
|
|
75
|
+
text="Hi, How are you doing today?",
|
|
76
|
+
voice_id="Gordon",
|
|
77
|
+
model="falcon-2.1",
|
|
78
|
+
locale="en-US",
|
|
79
|
+
sample_rate=SAMPLE_RATE,
|
|
80
|
+
format="PCM"
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
# Setup audio stream for playback
|
|
84
|
+
pa = pyaudio.PyAudio()
|
|
85
|
+
stream = pa.open(format=FORMAT, channels=CHANNELS, rate=SAMPLE_RATE, output=True)
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
print("Starting audio playback...")
|
|
89
|
+
for chunk in audio_stream:
|
|
90
|
+
if chunk: # Check if chunk has data
|
|
91
|
+
stream.write(chunk)
|
|
92
|
+
except Exception as e:
|
|
93
|
+
print(f"Error during streaming: {e}")
|
|
94
|
+
finally:
|
|
95
|
+
stream.stop_stream()
|
|
96
|
+
stream.close()
|
|
97
|
+
pa.terminate()
|
|
98
|
+
print("Audio streaming and playback complete!")
|
|
99
|
+
|
|
100
|
+
if __name__ == "__main__":
|
|
101
|
+
play_streaming_audio()
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
See [HTTP streaming](https://murf.ai/api/docs/text-to-speech/streaming) for regions, formats, and WebSocket streaming.
|
|
105
|
+
|
|
106
|
+
### Synthesize (Gen 2)
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from murf import Murf
|
|
110
|
+
|
|
111
|
+
client = Murf(
|
|
112
|
+
api_key="YOUR_API_KEY", # Not required if MURF_API_KEY is set
|
|
113
|
+
)
|
|
114
|
+
res = client.text_to_speech.generate(
|
|
115
|
+
text="There is much to be said",
|
|
116
|
+
voice_id="Terrell",
|
|
117
|
+
locale="en-US",
|
|
118
|
+
)
|
|
119
|
+
print(res.audio_file)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The response includes a URL to the generated audio file. The file is available for download for 72 hours. See [Synthesize](https://murf.ai/api/docs/text-to-speech/synthesize).
|
|
123
|
+
|
|
124
|
+
### List Voices
|
|
125
|
+
|
|
126
|
+
Each model has its own voice catalog. Pass `model` when listing voices: `falcon-2.1` for streaming, `gen2` for synthesis.
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from murf import Murf
|
|
130
|
+
|
|
131
|
+
client = Murf(api_key="YOUR_API_KEY")
|
|
132
|
+
streaming_voices = client.text_to_speech.get_voices(model="falcon-2.1")
|
|
133
|
+
studio_voices = client.text_to_speech.get_voices(model="gen2")
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
See [List Voices](https://murf.ai/api/docs/api-reference/voices/get-voices) and the [Voice Library](https://murf.ai/api/docs/voices-styles/voice-library).
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Features
|
|
141
|
+
|
|
142
|
+
- **Streaming (Falcon 2.1):** Real-time speech for voice agents and conversational AI. See [Falcon 2.1](https://murf.ai/api/docs/text-to-speech-models/falcon-2-1) and [HTTP streaming](https://murf.ai/api/docs/text-to-speech/streaming).
|
|
143
|
+
- **Synthesize (Gen 2):** Studio-quality voiceover files with styles, pauses, duration, and variation. See [Gen 2](https://murf.ai/api/docs/text-to-speech-models/gen-2) and [Synthesize](https://murf.ai/api/docs/text-to-speech/synthesize).
|
|
144
|
+
- **Model-specific voice catalogs:** Fetch streaming voices with `get_voices(model="falcon-2.1")` and studio voices with `get_voices(model="gen2")`. See [List Voices](https://murf.ai/api/docs/api-reference/voices/get-voices) and the [Voice Library](https://murf.ai/api/docs/voices-styles/voice-library).
|
|
145
|
+
- **150+ voices across 35 languages** and 20+ speaking styles.
|
|
146
|
+
|
|
147
|
+

|
|
148
|
+
|
|
149
|
+
- **Voice customization:** Adjust pitch, rate, locale, and pronunciation. Styles, pauses, duration, and variation are available on Synthesize (Gen 2).
|
|
150
|
+
- **Multiple audio formats:** MP3, WAV, FLAC, PCM, and others, with configurable sample rates.
|
|
151
|
+
- **Sync and async clients:** Blocking calls with `Murf`, or non-blocking calls with `AsyncMurf`.
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Async Client
|
|
157
|
+
|
|
158
|
+
The SDK also exports an `async` client so that you can make non-blocking calls to our API.
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
import asyncio
|
|
162
|
+
from murf import AsyncMurf, MurfRegion
|
|
163
|
+
|
|
164
|
+
client = AsyncMurf(
|
|
165
|
+
api_key="YOUR_API_KEY",
|
|
166
|
+
region=MurfRegion.GLOBAL,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
async def main() -> None:
|
|
171
|
+
audio_stream = client.text_to_speech.stream(
|
|
172
|
+
text="Hi, How are you doing today?",
|
|
173
|
+
voice_id="Gordon",
|
|
174
|
+
model="falcon-2.1",
|
|
175
|
+
locale="en-US",
|
|
176
|
+
sample_rate=24000,
|
|
177
|
+
format="PCM",
|
|
178
|
+
)
|
|
179
|
+
async for chunk in audio_stream:
|
|
180
|
+
if chunk:
|
|
181
|
+
pass
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
asyncio.run(main())
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Exception Handling
|
|
190
|
+
|
|
191
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
192
|
+
will be thrown.
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from murf.core.api_error import ApiError
|
|
196
|
+
|
|
197
|
+
try:
|
|
198
|
+
client.text_to_speech.generate(...)
|
|
199
|
+
except ApiError as e:
|
|
200
|
+
print(e.status_code)
|
|
201
|
+
print(e.body)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Advanced
|
|
207
|
+
|
|
208
|
+
### Retries
|
|
209
|
+
|
|
210
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
211
|
+
as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
|
|
212
|
+
retry limit (default: 2).
|
|
213
|
+
|
|
214
|
+
A request is deemed retriable when any of the following HTTP status codes is returned:
|
|
215
|
+
|
|
216
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
217
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
218
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
219
|
+
|
|
220
|
+
Use the `max_retries` request option to configure this behavior.
|
|
221
|
+
|
|
222
|
+
```python
|
|
223
|
+
client.text_to_speech.generate(..., request_options={
|
|
224
|
+
"max_retries": 1
|
|
225
|
+
})
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Timeouts
|
|
229
|
+
|
|
230
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
|
|
234
|
+
from murf import Murf
|
|
235
|
+
|
|
236
|
+
client = Murf(
|
|
237
|
+
...,
|
|
238
|
+
timeout=20.0,
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
# Override timeout for a specific method
|
|
243
|
+
client.text_to_speech.generate(..., request_options={
|
|
244
|
+
"timeout_in_seconds": 1
|
|
245
|
+
})
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Custom Client
|
|
249
|
+
|
|
250
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
251
|
+
and transports.
|
|
252
|
+
```python
|
|
253
|
+
import httpx
|
|
254
|
+
from murf import Murf
|
|
255
|
+
|
|
256
|
+
client = Murf(
|
|
257
|
+
...,
|
|
258
|
+
httpx_client=httpx.Client(
|
|
259
|
+
proxies="http://my.test.proxy.example.com",
|
|
260
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
261
|
+
),
|
|
262
|
+
)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Contributing
|
|
268
|
+
|
|
269
|
+
We welcome contributions to enhance the Murf Python SDK. Please note that this library is generated programmatically, so direct modifications may be overwritten. We suggest opening an issue first to discuss your ideas or improvements. Contributions to the documentation are especially appreciated! For any support queries email to support@murf.ai
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
Murf Python SDK is released under the [MIT License](LICENSE).
|
|
276
|
+
|
|
277
|
+
---
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "murf"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
|
|
5
|
+
[tool.poetry]
|
|
6
|
+
name = "murf"
|
|
7
|
+
version = "2.4.1"
|
|
8
|
+
description = ""
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = []
|
|
11
|
+
keywords = []
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Programming Language :: Python :: 3.15",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Operating System :: POSIX",
|
|
24
|
+
"Operating System :: MacOS",
|
|
25
|
+
"Operating System :: POSIX :: Linux",
|
|
26
|
+
"Operating System :: Microsoft :: Windows",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
"Typing :: Typed"
|
|
29
|
+
]
|
|
30
|
+
packages = [
|
|
31
|
+
{ include = "murf", from = "src"}
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[tool.poetry.urls]
|
|
35
|
+
Repository = 'https://github.com/murf-ai/murf-python-sdk'
|
|
36
|
+
|
|
37
|
+
[tool.poetry.dependencies]
|
|
38
|
+
python = "^3.10"
|
|
39
|
+
aiohttp = { version = ">=3.14.1,<4", optional = true, python = ">=3.10"}
|
|
40
|
+
httpx = ">=0.21.2"
|
|
41
|
+
httpx-aiohttp = { version = "^0.1.8", optional = true, python = ">=3.10"}
|
|
42
|
+
pydantic = ">= 1.9.2"
|
|
43
|
+
pydantic-core = ">=2.18.2,<3.0.0"
|
|
44
|
+
typing_extensions = ">= 4.0.0"
|
|
45
|
+
|
|
46
|
+
[tool.poetry.group.dev.dependencies]
|
|
47
|
+
mypy = "==1.13.0"
|
|
48
|
+
pytest = "^9.0.3"
|
|
49
|
+
pytest-asyncio = "^1.0.0"
|
|
50
|
+
pytest-xdist = "^3.6.1"
|
|
51
|
+
python-dateutil = "^2.9.0"
|
|
52
|
+
types-python-dateutil = "^2.9.0.20240316"
|
|
53
|
+
urllib3 = ">=2.6.3,<3.0.0"
|
|
54
|
+
ruff = "==0.11.5"
|
|
55
|
+
|
|
56
|
+
[tool.pytest.ini_options]
|
|
57
|
+
testpaths = [ "tests" ]
|
|
58
|
+
asyncio_mode = "auto"
|
|
59
|
+
norecursedirs = [ "src" ]
|
|
60
|
+
markers = [
|
|
61
|
+
"aiohttp: tests that require httpx_aiohttp to be installed",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[tool.mypy]
|
|
65
|
+
plugins = ["pydantic.mypy"]
|
|
66
|
+
|
|
67
|
+
[tool.ruff]
|
|
68
|
+
line-length = 120
|
|
69
|
+
|
|
70
|
+
[tool.ruff.lint]
|
|
71
|
+
select = [
|
|
72
|
+
"E", # pycodestyle errors
|
|
73
|
+
"F", # pyflakes
|
|
74
|
+
"I", # isort
|
|
75
|
+
]
|
|
76
|
+
ignore = [
|
|
77
|
+
"E402", # Module level import not at top of file
|
|
78
|
+
"E501", # Line too long
|
|
79
|
+
"E711", # Comparison to `None` should be `cond is not None`
|
|
80
|
+
"E712", # Avoid equality comparisons to `True`; use `if ...:` checks
|
|
81
|
+
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks
|
|
82
|
+
"E722", # Do not use bare `except`
|
|
83
|
+
"E731", # Do not assign a `lambda` expression, use a `def`
|
|
84
|
+
"F821", # Undefined name
|
|
85
|
+
"F841" # Local variable ... is assigned to but never used
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint.isort]
|
|
89
|
+
section-order = ["future", "standard-library", "third-party", "first-party"]
|
|
90
|
+
|
|
91
|
+
[build-system]
|
|
92
|
+
requires = ["poetry-core"]
|
|
93
|
+
build-backend = "poetry.core.masonry.api"
|
|
94
|
+
|
|
95
|
+
[tool.poetry.extras]
|
|
96
|
+
aiohttp=["aiohttp", "httpx-aiohttp"]
|