Repository: home-assistant/core
File: homeassistant/components/remote_calendar/coordinator.py (Python)

Code before:

_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(days=1)


class RemoteCalendarDataUpdateCoordinator(DataUpdateCoordinator[Calendar]):
    """Class to manage fetching calendar data."""

    config_entry: RemoteCalendarConfigEntry
    ics: str

    def __init__(
        self,
        hass: HomeAssistant,
        config_entry: RemoteCalendarConfigEntry,
    ) -> None:
        """Initialize data updater."""
        super().__init__(
            hass,
            _LOGGER,
            name=f"{DOMAIN}_{config_entry.title}",
            update_interval=SCAN_INTERVAL,
            config_entry=config_entry,
            always_update=True,
        )
        self._client = get_async_client(hass)
        self._url = config_entry.data[CONF_URL]

    async def _async_update_data(self) -> Calendar:
        """Update data from the url."""
        try:
            res = await get_calendar(self._client, self._url)
            res.raise_for_status()
        except TimeoutException as err:
            _LOGGER.debug("%s: %s", self._url, str(err) or type(err).__name__)
            raise UpdateFailed(
                translation_domain=DOMAIN,
                translation_key="timeout",
            ) from err
        except (HTTPError, InvalidURL) as err:
            _LOGGER.debug("%s: %s", self._url, str(err) or type(err).__name__)
            raise UpdateFailed(
                translation_domain=DOMAIN,
                translation_key="unable_to_fetch",
            ) from err
        try:
            self.ics = res.text
            return await parse_calendar(self.hass, res.text)
        except InvalidIcsException as err:
            raise UpdateFailed(
                translation_domain=DOMAIN,

Review comment (suggestion):
If the migration is finished, you no longer need the `get(CONF_VERIFY_SSL, True)`, since you get the actual value from what's already configured.
Also, you're enforcing SSL by default. What happens in the cases users we don't have SSL supported? These integrations would render in an error from here on.

Code after:

_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(days=1)


class RemoteCalendarDataUpdateCoordinator(DataUpdateCoordinator[Calendar]):
    """Class to manage fetching calendar data."""

    config_entry: RemoteCalendarConfigEntry
    ics: str

    def __init__(
        self,
        hass: HomeAssistant,
        config_entry: RemoteCalendarConfigEntry,
    ) -> None:
        """Initialize data updater."""
        super().__init__(
            hass,
            _LOGGER,
            name=f"{DOMAIN}_{config_entry.title}",
            update_interval=SCAN_INTERVAL,
            config_entry=config_entry,
            always_update=True,
        )
        self._client = get_async_client(
            hass, verify_ssl=config_entry.data.get(CONF_VERIFY_SSL, True)
        )
        self._url = config_entry.data[CONF_URL]

    async def _async_update_data(self) -> Calendar:
        """Update data from the url."""
        try:
            res = await get_calendar(self._client, self._url)
            res.raise_for_status()
        except TimeoutException as err:
            _LOGGER.debug("%s: %s", self._url, str(err) or type(err).__name__)
            raise UpdateFailed(
                translation_domain=DOMAIN,
                translation_key="timeout",
            ) from err
        except (HTTPError, InvalidURL) as err:
            _LOGGER.debug("%s: %s", self._url, str(err) or type(err).__name__)
            raise UpdateFailed(
                translation_domain=DOMAIN,
                translation_key="unable_to_fetch",
            ) from err
        try:
            self.ics = res.text
            return await parse_calendar(self.hass, res.text)
        except InvalidIcsException as err: