mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Use load_json_object in matrix (#88587)
This commit is contained in:
parent
42d90538e4
commit
10bb0ab6b4
@ -21,7 +21,7 @@ from homeassistant.exceptions import HomeAssistantError
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.json import save_json
|
from homeassistant.helpers.json import save_json
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util.json import load_json
|
from homeassistant.util.json import JsonObjectType, load_json_object
|
||||||
|
|
||||||
from .const import DOMAIN, FORMAT_HTML, FORMAT_TEXT, SERVICE_SEND_MESSAGE
|
from .const import DOMAIN, FORMAT_HTML, FORMAT_TEXT, SERVICE_SEND_MESSAGE
|
||||||
|
|
||||||
@ -276,15 +276,13 @@ class MatrixBot:
|
|||||||
except MatrixRequestError as ex:
|
except MatrixRequestError as ex:
|
||||||
_LOGGER.error("Could not join room %s: %s", room_id, ex)
|
_LOGGER.error("Could not join room %s: %s", room_id, ex)
|
||||||
|
|
||||||
def _get_auth_tokens(self):
|
def _get_auth_tokens(self) -> JsonObjectType:
|
||||||
"""Read sorted authentication tokens from disk.
|
"""Read sorted authentication tokens from disk.
|
||||||
|
|
||||||
Returns the auth_tokens dictionary.
|
Returns the auth_tokens dictionary.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
auth_tokens = load_json(self._session_filepath)
|
return load_json_object(self._session_filepath)
|
||||||
|
|
||||||
return auth_tokens
|
|
||||||
except HomeAssistantError as ex:
|
except HomeAssistantError as ex:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Loading authentication tokens from file '%s' failed: %s",
|
"Loading authentication tokens from file '%s' failed: %s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user