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