Skip to content

Commit

Permalink
Merge pull request #917 from mkevac/fix_for_non_json_responses
Browse files Browse the repository at this point in the history
do not fail if response is not json (e.g. xml)
  • Loading branch information
thomasht86 authored Sep 17, 2024
2 parents 7269954 + 18f6a6d commit 86a3d4b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vespa/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,10 @@ def _request_with_api_key(
response = self.get_connection_response_with_retry(method, path, body, headers)
if return_raw_response:
return response
parsed = json.load(response)
try:
parsed = json.load(response)
except json.JSONDecodeError:
parsed = response.read()
if response.status_code != 200:
print(parsed)
raise HTTPError(
Expand Down

0 comments on commit 86a3d4b

Please sign in to comment.