Change time conversion to something that supports older python versions

This commit is contained in:
Kevin Fronczak
2020-04-09 14:51:06 -04:00
parent 2f4e8fcade
commit 2ebbe46ada
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -3,9 +3,9 @@
import logging
import time
from calendar import timegm
from datetime import datetime
from functools import partial, wraps
from requests import Request, Session, exceptions
import dateutil.parser
from blinkpy.helpers.constants import BLINK_URL, TIMESTAMP_FORMAT
import blinkpy.helpers.errors as ERROR
@@ -16,7 +16,7 @@ _LOGGER = logging.getLogger(__name__)
def time_to_seconds(timestamp):
"""Convert TIMESTAMP_FORMAT time to seconds."""
try:
dtime = datetime.strptime(timestamp, TIMESTAMP_FORMAT)
dtime = dateutil.parser.isoparse(timestamp)
except ValueError:
_LOGGER.error("Incorrect timestamp format for conversion: %s.",
timestamp)
+1 -1
View File
@@ -164,7 +164,7 @@ class BlinkSyncModule():
def check_new_videos(self):
"""Check if new videos since last refresh."""
try:
interval = self.blink.last_refresh - self.motion_interval*60
interval = self.blink.last_refresh - self.motion_interval * 60
except TypeError:
# This is the first start, so refresh hasn't happened yet.
# No need to check for motion.