File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -94,10 +94,12 @@ def object_from_dictionary(cls, entry):
9494 for like in entry ['likes' ]['data' ]:
9595 new_media .likes .append (User .object_from_dictionary (like ))
9696
97- new_media .comment_count = entry ['comments' ]['count' ]
98- new_media .comments = []
99- for comment in entry ['comments' ]['data' ]:
100- new_media .comments .append (Comment .object_from_dictionary (comment ))
97+ new_media .comment_count = entry .get ('comments' , {}).get ('count' , 0 )
98+ if new_media .comment_count :
99+ new_media .comments = []
100+ if entry .get ('comments' , {}).get ('data' ):
101+ for comment in entry ['comments' ]['data' ]:
102+ new_media .comments .append (Comment .object_from_dictionary (comment ))
101103
102104 new_media .users_in_photo = []
103105 if entry .get ('users_in_photo' ):
You can’t perform that action at this time.
0 commit comments