diff --git a/instagram/models.py b/instagram/models.py index d2517ca2..47ae6817 100644 --- a/instagram/models.py +++ b/instagram/models.py @@ -96,8 +96,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 entry['comments'].get('data'): + 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'):