Describe return type of Post.get_{likes,comments}
This commit is contained in:
parent
374f13adbf
commit
fd6389249c
@ -364,7 +364,11 @@ class Post:
|
|||||||
return self._field('edge_media_to_comment', 'count')
|
return self._field('edge_media_to_comment', 'count')
|
||||||
|
|
||||||
def get_comments(self) -> Iterator[Dict[str, Any]]:
|
def get_comments(self) -> Iterator[Dict[str, Any]]:
|
||||||
"""Iterate over all comments of the post."""
|
"""Iterate over all comments of the post.
|
||||||
|
|
||||||
|
Each comment is represented by a dictionary having the keys text, created_at, id and owner, which is a
|
||||||
|
dictionary with keys username, profile_pic_url and id.
|
||||||
|
"""
|
||||||
if self.comments == 0:
|
if self.comments == 0:
|
||||||
# Avoid doing additional requests if there are no comments
|
# Avoid doing additional requests if there are no comments
|
||||||
return
|
return
|
||||||
@ -377,7 +381,11 @@ class Post:
|
|||||||
lambda d: d['data']['shortcode_media']['edge_media_to_comment'])
|
lambda d: d['data']['shortcode_media']['edge_media_to_comment'])
|
||||||
|
|
||||||
def get_likes(self) -> Iterator[Dict[str, Any]]:
|
def get_likes(self) -> Iterator[Dict[str, Any]]:
|
||||||
"""Iterate over all likes of the post."""
|
"""Iterate over all likes of the post.
|
||||||
|
|
||||||
|
Each like is represented by a dictionary having the keys username, followed_by_viewer, id, is_verified,
|
||||||
|
requested_by_viewer, followed_by_viewer, profile_pic_url.
|
||||||
|
"""
|
||||||
if self.likes == 0:
|
if self.likes == 0:
|
||||||
# Avoid doing additional requests if there are no comments
|
# Avoid doing additional requests if there are no comments
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user