def from_commenters_of(self, account_name: str, limit: int) -> "Input": commenters = [] posts = self._get_posts(account_name) for post in posts: commenters.extend(get_commenters_of_post(self._client, post['id'])) if len(commenters) > limit: break self.accounts.extend(commenters[:limit:]) return self
def from_commenters_of(self, account_name: str, limit: int) -> "Input": """Retrieves accounts that have commented on recent posts of `account_name`. Args: account_name: the account to retrieve from limit: the amount of accounts to retrieve """ commenters = [] posts = self._get_posts(account_name) for post in posts: commenters.extend(get_commenters_of_post(self._client, post['id'])) if len(commenters) > limit: break self._accounts.extend(commenters[:limit:]) return self
from instauto.api.client import ApiClient from instauto.helpers.post import get_commenters_of_post client = ApiClient.initiate_from_file('.instauto.save') posts = get_commenters_of_post(client, "media_id")