Fix Advoware API call to return None on JSON parse error instead of raising, for methods like DELETE that return 200 with no body.
This commit is contained in:
@@ -147,12 +147,8 @@ class AdvowareAPI:
|
|||||||
return await response.json()
|
return await response.json()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._log(f"JSON parse error: {e}")
|
self._log(f"JSON parse error: {e}")
|
||||||
try:
|
# For methods like DELETE that may return 200 with no body, return None
|
||||||
text = await response.text()
|
return None
|
||||||
self._log(f"Response text: {text}")
|
|
||||||
except Exception as text_e:
|
|
||||||
self._log(f"Error getting response text: {text_e}")
|
|
||||||
raise
|
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
except aiohttp.ClientError as e:
|
except aiohttp.ClientError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user