MCPcopy
hub / github.com/InstaPy/InstaPy / interact_by_users

Method interact_by_users

instapy/instapy.py:2417–2746  ·  view source on GitHub ↗

Likes some amounts of images for each usernames

(
        self,
        usernames: list,
        amount: int = 10,
        randomize: bool = False,
        media: str = None,
    )

Source from the content-addressed store, hash-verified

2415 return self
2416
2417 def interact_by_users(
2418 self,
2419 usernames: list,
2420 amount: int = 10,
2421 randomize: bool = False,
2422 media: str = None,
2423 ):
2424 """Likes some amounts of images for each usernames"""
2425 if self.aborting:
2426 return self
2427
2428 message = "Starting to interact by users.."
2429 highlight_print(self.username, message, "feature", "info", self.logger)
2430
2431 if not isinstance(usernames, list):
2432 usernames = [usernames]
2433
2434 # standalone means this feature is started by the user
2435 standalone = (
2436 True if "interact_by_users" not in self.internal_usage.keys() else False
2437 )
2438 # skip validation in case of it is already accomplished
2439 users_validated = (
2440 True
2441 if not standalone
2442 and not self.internal_usage["interact_by_users"]["validate"]
2443 else False
2444 )
2445
2446 total_liked_img = 0
2447 already_liked = 0
2448 inap_img = 0
2449 commented = 0
2450 followed = 0
2451 already_followed = 0
2452 not_valid_users = 0
2453
2454 self.quotient_breach = False
2455
2456 for index, username in enumerate(usernames):
2457 if self.quotient_breach:
2458 # keep `quotient_breach` active to break the internal
2459 # iterators of the caller
2460 self.quotient_breach = True if not standalone else False
2461 break
2462
2463 self.logger.info("Username [{}/{}]".format(index + 1, len(usernames)))
2464 self.logger.info("--> {}".format(username.encode("utf-8")))
2465
2466 if not users_validated:
2467 validation, details = self.validate_user_call(username)
2468 if not validation:
2469 self.logger.info("--> not a valid user: {}".format(details))
2470 not_valid_users += 1
2471 continue
2472
2473 track = "profile"
2474 # decision making

Callers 7

follow_by_listMethod · 0.95
interact_user_likersMethod · 0.95
follow_by_tagsMethod · 0.95
interact_by_URLMethod · 0.95
interact_by_commentsMethod · 0.95

Calls 12

validate_user_callMethod · 0.95
query_clarifaiMethod · 0.95
story_by_usersMethod · 0.95
highlight_printFunction · 0.85
follow_restrictionFunction · 0.85
get_links_for_usernameFunction · 0.85
check_linkFunction · 0.85
verify_likingFunction · 0.85
like_imageFunction · 0.85
process_commentsFunction · 0.85
sleepFunction · 0.85
follow_userFunction · 0.85

Tested by

no test coverage detected