From 928ca39c8c62175add6a9b5c19a107c1af145803 Mon Sep 17 00:00:00 2001 From: retoor Date: Sun, 19 Jan 2025 02:19:13 +0100 Subject: [PATCH] Is none check. --- src/rspeech/gcloud.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rspeech/gcloud.py b/src/rspeech/gcloud.py index 38def7a..8d72ba0 100644 --- a/src/rspeech/gcloud.py +++ b/src/rspeech/gcloud.py @@ -104,6 +104,8 @@ async def tts(text:str ,google_project:str="lisa-448004", language_code:str="nl- response = await session.post(url, headers=headers, json=data) response_json = await response.json() audio_content = response_json.get("audioContent") + if not audio_content: + return file = pathlib.Path(str(uuid.uuid4()) + ".mp3") with file.open("wb") as audio_file: audio_file.write(base64.b64decode(audio_content.encode('latin1')))