From a5d8865c00b011ff677e594f4388b98bac4f1b43 Mon Sep 17 00:00:00 2001 From: Jose Andrade Date: Wed, 27 Sep 2017 12:00:55 -0500 Subject: [PATCH 1/2] fix data key --- instagram/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/instagram/models.py b/instagram/models.py index d2517ca2..a1ae1c5a 100644 --- a/instagram/models.py +++ b/instagram/models.py @@ -84,6 +84,8 @@ def object_from_dictionary(cls, entry): if new_media.type == 'video': new_media.videos = {} for version, version_info in six.iteritems(entry['videos']): + print '###'*80 + print version_info new_media.videos[version] = Video.object_from_dictionary(version_info) if 'user_has_liked' in entry: @@ -96,8 +98,9 @@ def object_from_dictionary(cls, entry): new_media.comment_count = entry['comments']['count'] new_media.comments = [] - for comment in entry['comments']['data']: - new_media.comments.append(Comment.object_from_dictionary(comment)) + if "data" in entry["comments"]: + for comment in entry['comments']['data']: + new_media.comments.append(Comment.object_from_dictionary(comment)) new_media.users_in_photo = [] if entry.get('users_in_photo'): From c5255ef102d7c5a6b8214173235b07737b0e3051 Mon Sep 17 00:00:00 2001 From: Jose Andrade Date: Wed, 27 Sep 2017 12:15:11 -0500 Subject: [PATCH 2/2] fix got an unexpected keyword argument 'id' --- instagram/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/instagram/models.py b/instagram/models.py index d2517ca2..78835bc3 100644 --- a/instagram/models.py +++ b/instagram/models.py @@ -84,6 +84,7 @@ def object_from_dictionary(cls, entry): if new_media.type == 'video': new_media.videos = {} for version, version_info in six.iteritems(entry['videos']): + version_info.pop('id', None) new_media.videos[version] = Video.object_from_dictionary(version_info) if 'user_has_liked' in entry: