Skip to content

Commit 20f6ce5

Browse files
authored
Merge pull request #36 from JigsawStack/fix/jigsawstack-audio-tts
2 parents 0100955 + e58e806 commit 20f6ce5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ venv/
33
.pytest_cache/
44
jigsawstack.egg-info/
55

6+
__pycache__/
7+
/.pytest_cache/
8+
/.vscode/
9+
/.idea/
10+
11+
12+
*.ipynb_checkpoints/
13+
*.ipynb
14+
615
.env
716
build/
817
dist/

jigsawstack/request.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def perform(self) -> Union[T, None]:
5656

5757
# this is a safety net, if we get here it means the JigsawStack API is having issues
5858
# and most likely the gateway is returning htmls
59-
if "application/json" not in resp.headers["content-type"]:
59+
if "application/json" not in resp.headers["content-type"] and "audio/wav" not in resp.headers["content-type"]:
6060
raise_for_code_and_type(
6161
code=500,
6262
message="Failed to parse JigsawStack API response. Please try again.",
@@ -72,6 +72,9 @@ def perform(self) -> Union[T, None]:
7272
err=error.get("error"),
7373
)
7474

75+
if "audio/wav" in resp.headers["content-type"]:
76+
return cast(T, resp) # we return the response object, instead of the json
77+
7578
return cast(T, resp.json())
7679

7780
def perform_file(self) -> Union[T, None]:

0 commit comments

Comments
 (0)