Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvonthenen committed Oct 18, 2024
1 parent 5754a1b commit 1bac9e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions deepgram/clients/common/v1/abstract_async_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ async def _handle_request(
method, _url, headers=_headers, **kwargs
)
response.raise_for_status()

# throw exception if response is None or response.text is None
if response is None or response.text is None:
raise DeepgramError(
"Response is not available yet. Please try again later."
)

return response.text

except httpx.HTTPError as e1:
Expand Down
7 changes: 7 additions & 0 deletions deepgram/clients/common/v1/abstract_sync_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ def _handle_request(
kwargs.pop("transport")
response = client.request(method, _url, headers=_headers, **kwargs)
response.raise_for_status()

# throw exception if response is None or response.text is None
if response is None or response.text is None:
raise DeepgramError(
"Response is not available yet. Please try again later."
)

return response.text

except httpx.HTTPError as e1:
Expand Down

0 comments on commit 1bac9e4

Please sign in to comment.