Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Fix argument id and data keyword #256

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions instagram/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -96,8 +97,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'):
Expand Down