mirror of
https://github.com/sudoxnym/roomba_rest980.git
synced 2026-04-14 11:37:46 +00:00
improt decode erorr
This commit is contained in:
parent
42c6a09b11
commit
292a97e33b
1 changed files with 5 additions and 3 deletions
|
|
@ -14,6 +14,8 @@ from typing import Any
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from json.decoder import JSONDecodeError
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
@ -230,7 +232,7 @@ class iRobotCloudApi:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
login_result = json.loads(response_text)
|
login_result = json.loads(response_text)
|
||||||
except json.JSONDecodeError as e:
|
except JSONDecodeError as e:
|
||||||
raise AuthenticationError(
|
raise AuthenticationError(
|
||||||
f"Invalid JSON response from Gigya login: {response_text}"
|
f"Invalid JSON response from Gigya login: {response_text}"
|
||||||
) from e
|
) from e
|
||||||
|
|
@ -328,7 +330,7 @@ class iRobotCloudApi:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
login_result = json.loads(response_text)
|
login_result = json.loads(response_text)
|
||||||
except json.JSONDecodeError as e:
|
except JSONDecodeError as e:
|
||||||
raise AuthenticationError(
|
raise AuthenticationError(
|
||||||
f"Invalid JSON response from iRobot login: {response_text}"
|
f"Invalid JSON response from iRobot login: {response_text}"
|
||||||
) from e
|
) from e
|
||||||
|
|
@ -526,7 +528,7 @@ class iRobotCloudApi:
|
||||||
existing_data = json.loads(content)
|
existing_data = json.loads(content)
|
||||||
if not isinstance(existing_data, list):
|
if not isinstance(existing_data, list):
|
||||||
existing_data = [existing_data]
|
existing_data = [existing_data]
|
||||||
except (json.JSONDecodeError, OSError):
|
except (JSONDecodeError, OSError):
|
||||||
existing_data = []
|
existing_data = []
|
||||||
|
|
||||||
# Add new data
|
# Add new data
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue