From 801ee8f7f77a49ab07a6c39f9e019f1e30dd963b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 9 Oct 2016 23:38:03 +0200 Subject: [PATCH] Fix Python 3 issues in Photos service --- pyicloud/services/photos.py | 8 +++++--- requirements.txt | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pyicloud/services/photos.py b/pyicloud/services/photos.py index c8eda8f..5e02391 100644 --- a/pyicloud/services/photos.py +++ b/pyicloud/services/photos.py @@ -1,6 +1,5 @@ import sys import json -import urllib from datetime import datetime from base64 import b64decode @@ -11,6 +10,9 @@ from pyicloud.exceptions import ( PyiCloudPhotoLibraryNotActivatedErrror ) +from future.moves.urllib.parse import unquote +from future.utils import listvalues, listitems + class PhotosService(object): """ The 'Photos' iCloud service.""" @@ -188,7 +190,7 @@ class PhotoAlbum(object): orientation, self) previous_asset_id = asset_id - return assets.values() + return listvalues(assets) def _fetch_asset_data_for(self, asset): if asset.client_id in self.service._photo_assets: @@ -268,7 +270,7 @@ class PhotoAsset(object): 'height': height, 'size': size, 'mimetype': mimetype, - 'url': urllib.unquote(url), + 'url': unquote(url), 'filename': filename, } return versions diff --git a/requirements.txt b/requirements.txt index 175a884..fe0946b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ six>=1.9.0 tzlocal certifi bitstring +future