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

View file

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