MCPcopy
hub / github.com/InstaPy/InstaPy / accept_follow_requests

Method accept_follow_requests

instapy/instapy.py:5868–5906  ·  view source on GitHub ↗

Accept pending follow requests from activity feed

(self, amount: int = 100, sleep_delay: int = 1)

Source from the content-addressed store, hash-verified

5866 )
5867
5868 def accept_follow_requests(self, amount: int = 100, sleep_delay: int = 1):
5869 """Accept pending follow requests from activity feed"""
5870
5871 if self.aborting:
5872 return self
5873
5874 message = "Starting to get follow requests.."
5875 highlight_print(self.username, message, "feature", "info", self.logger)
5876
5877 accepted = 0
5878 while accepted < amount:
5879
5880 feed_link = "https://www.instagram.com/accounts/activity/?followRequests=1"
5881 web_address_navigator(self.browser, feed_link)
5882
5883 requests_to_confirm = self.browser.find_elements(
5884 By.XPATH, "//button[text()='Confirm']"
5885 )
5886
5887 if len(requests_to_confirm) == 0:
5888 self.logger.info("There are no follow requests in activity feed")
5889 break
5890
5891 for request in requests_to_confirm:
5892 request.click()
5893 sleep(sleep_delay)
5894 accepted += 1
5895 if accepted >= amount:
5896 self.logger.info(
5897 "Reached accepted accounts limit of {} requests".format(amount)
5898 )
5899 break
5900 # catch if the list cannot be accessed, there are more followers under the hood or
5901 # because another element <a class="gKAyB " href="/accounts/activity/"> obscures it...
5902 scroll_down(self.browser)
5903
5904 self.logger.info("Accepted {} follow requests".format(accepted))
5905
5906 return self
5907
5908 def join_pods(self, topic: str = "general", engagement_mode: str = "normal"):
5909 """Join pods"""

Callers

nothing calls this directly

Calls 4

highlight_printFunction · 0.85
web_address_navigatorFunction · 0.85
sleepFunction · 0.85
scroll_downFunction · 0.85

Tested by

no test coverage detected