Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
total_liked_img = 0
already_liked = 0
inap_img = 0
commented = 0
followed = 0
not_valid_users = 0
usernames = usernames or []
for index, username in enumerate(usernames):
self.logger.info(
'Username [{}/{}]'.format(index + 1, len(usernames)))
self.logger.info('--> {}'.format(username.encode('utf-8')))
validation, details = validate_username(self.browser,
username,
self.username,
self.ignore_users,
self.blacklist,
self.potency_ratio,
self.delimit_by_numbers,
self.max_followers,
self.max_following,
self.min_followers,
self.min_following,
self.logger)
if validation != True:
self.logger.info(details)
not_valid_users += 1
continue
if not isinstance(followlist, list):
followlist = [followlist]
self.follow_times = times or 0
if self.aborting:
self.logger.info(">>> self aborting prevented")
#return self
followed_all = 0
followed_new = 0
not_valid_users = 0
relax_point = random.randint(7, 14) # you can use some plain value `10` instead of this quitely randomized score
for acc_to_follow in followlist:
# Verify if the user should be followed
validation, details = validate_username(self.browser,
acc_to_follow,
self.username,
self.ignore_users,
self.blacklist,
self.potency_ratio,
self.delimit_by_numbers,
self.max_followers,
self.max_following,
self.min_followers,
self.min_following,
self.logger)
if validation != True or acc_to_follow==self.username:
self.logger.info(details)
not_valid_users += 1
continue
total_liked_img = 0
already_liked = 0
inap_img = 0
commented = 0
followed = 0
not_valid_users = 0
usernames = usernames or []
for index, username in enumerate(usernames):
self.logger.info(
'Username [{}/{}]'.format(index + 1, len(usernames)))
self.logger.info('--> {}'.format(username.encode('utf-8')))
following = random.randint(0, 100) <= self.follow_percentage
validation, details = validate_username(self.browser,
username,
self.username,
self.ignore_users,
self.blacklist,
self.potency_ratio,
self.delimit_by_numbers,
self.max_followers,
self.max_following,
self.min_followers,
self.min_following,
self.logger)
if validation != True:
self.logger.info(details)
not_valid_users += 1
continue
try:
inappropriate, user_name, is_video, reason, scope = (
check_link(self.browser,
link,
self.dont_like,
self.ignore_if_contains,
self.logger)
)
if not inappropriate and self.delimit_liking:
self.liking_approved = verify_liking(self.browser, self.max_likes, self.min_likes, self.logger)
if not inappropriate and self.liking_approved:
#validate user
validation, details = validate_username(self.browser,
user_name,
self.username,
self.ignore_users,
self.blacklist,
self.potency_ratio,
self.delimit_by_numbers,
self.max_followers,
self.max_following,
self.min_followers,
self.min_following,
self.logger)
if validation != True:
self.logger.info(details)
not_valid_users += 1
continue
else:
if isinstance(err, RuntimeWarning):
self.logger.warning(
u'Warning: {} , skipping to next user'.format(err))
continue
else:
self.logger.error(
'Sorry, an error occured: {}'.format(err))
self.aborting = True
return self
interacted_personal = 0
for person in person_list:
if person in simulated_list:
validation, details = validate_username(self.browser,
person,
self.username,
self.ignore_users,
self.blacklist,
self.potency_ratio,
self.delimit_by_numbers,
self.max_followers,
self.max_following,
self.min_followers,
self.min_following,
self.logger)
if validation != True:
self.logger.info(details)
not_valid_users += 1
simulated_unfollow += 1
self.logger.info("Simulated unfollow: {} ~not valid user".format(simulated_unfollow))