Change time conversion to something that supports older python versions
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user