mirror of
https://github.com/home-assistant/core.git
synced 2026-08-22 14:21:15 +01:00
Avoid a naive datetime.now() in twitter (#179235)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Twitter platform for notify component."""
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import timedelta
|
||||
from functools import partial
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
@@ -23,6 +23,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.event import async_track_point_in_time
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -233,7 +234,7 @@ class TwitterNotificationService(BaseNotificationService):
|
||||
"media processing waiting %s seconds to check status", str(check_after_secs)
|
||||
)
|
||||
|
||||
when = datetime.now() + timedelta(seconds=check_after_secs) # pylint: disable=home-assistant-enforce-naive-now
|
||||
when = dt_util.now() + timedelta(seconds=check_after_secs)
|
||||
myself = partial(self.check_status_until_done, media_id, callback)
|
||||
async_track_point_in_time(self.hass, myself, when)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user