Use load_json_object in matrix (#88587)

This commit is contained in:
epenet 2023-02-22 13:56:11 +01:00 committed by GitHub
parent 42d90538e4
commit 10bb0ab6b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,7 @@ from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.json import save_json
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
@ -276,15 +276,13 @@ class MatrixBot:
except MatrixRequestError as 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.
Returns the auth_tokens dictionary.
"""
try:
auth_tokens = load_json(self._session_filepath)
return auth_tokens
return load_json_object(self._session_filepath)
except HomeAssistantError as ex:
_LOGGER.warning(
"Loading authentication tokens from file '%s' failed: %s",