photos: return time zone aware datetime object

This commit is contained in:
Philip Lundrigan 2017-05-30 12:09:16 -06:00 committed by Tor Arne Vestbø
parent f9a9818d03
commit bda08319fc
2 changed files with 5 additions and 2 deletions

View file

@ -10,6 +10,7 @@ from pyicloud.exceptions import (
PyiCloudBinaryFeedParseError, PyiCloudBinaryFeedParseError,
PyiCloudPhotoLibraryNotActivatedErrror PyiCloudPhotoLibraryNotActivatedErrror
) )
import pytz
from future.moves.urllib.parse import unquote from future.moves.urllib.parse import unquote
from future.utils import listvalues, listitems from future.utils import listvalues, listitems
@ -213,8 +214,9 @@ class PhotoAsset(object):
@property @property
def created(self): def created(self):
dt = datetime.fromtimestamp(self.data.get('createdDate') / 1000.0) dt = datetime.fromtimestamp(self.data.get('createdDate') / 1000.0,
return dt.strftime('%Y-%m-%dT%H:%M:%SZ') tz=pytz.utc)
return dt
@property @property
def dimensions(self): def dimensions(self):

View file

@ -4,6 +4,7 @@ keyrings.alt>=1.0,<2.0
click>=6.0,<7.0 click>=6.0,<7.0
six>=1.9.0 six>=1.9.0
tzlocal tzlocal
pytz
certifi certifi
bitstring bitstring
future future