Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
grabbed = len(set(all_followers))
# write & update records at Progress Tracker
progress_tracker(grabbed, highest_value, start_time, logger)
finish_time = time.time()
diff_time = finish_time - start_time
diff_n, diff_s = (
(diff_time / 60 / 60, "hours")
if diff_time / 60 / 60 >= 1
else (diff_time / 60, "minutes")
if diff_time / 60 >= 1
else (diff_time, "seconds")
)
diff_n = truncate_float(diff_n, 2)
passed_time = "{} {}".format(diff_n, diff_s)
if match is not None:
matched_followers = len(set(all_followers)) - len(
set(all_followers) - set(all_prior_followers)
)
if matched_followers >= match:
new_followers = set(all_followers) - set(all_prior_followers)
all_followers = all_followers + all_prior_followers
print("\n")
logger.info(
"Grabbed {} new usernames from `Followers` in {} "
"~total of {} usernames".format(
len(set(new_followers)),
passed_time,
len(set(all_followers)),
grabbed = len(set(all_following))
# write & update records at Progress Tracker
progress_tracker(grabbed, highest_value, start_time, logger)
finish_time = time.time()
diff_time = finish_time - start_time
diff_n, diff_s = (
(diff_time / 60 / 60, "hours")
if diff_time / 60 / 60 >= 1
else (diff_time / 60, "minutes")
if diff_time / 60 >= 1
else (diff_time, "seconds")
)
diff_n = truncate_float(diff_n, 2)
passed_time = "{} {}".format(diff_n, diff_s)
if match is not None:
matched_following = len(set(all_following)) - len(
set(all_following) - set(all_prior_following)
)
if matched_following >= match:
new_following = set(all_following) - set(all_prior_following)
all_following = all_following + all_prior_following
print("\n")
logger.info(
"Grabbed {} new usernames from `Following` in {} "
"~total of {} usernames".format(
len(set(new_following)),
passed_time,
len(set(all_following)),
elif store_locally is True:
print("")
logger.info(
"The `Following` data is identical with the data in previous "
"query ~not storing the file again"
)
if grab == "full":
relationship_data[username].update({"all_following": all_following})
sleep_t = sc_rolled * 6
sleep_t = sleep_t if sleep_t < 600 else random.randint(585, 655)
sleep_n, sleep_s = (
(sleep_t / 60, "minutes") if sleep_t / 60 >= 1 else (sleep_t, "seconds")
)
sleep_n = truncate_float(sleep_n, 4)
print("")
logger.info(
"Zz :[ time to take a good nap ~sleeping {} {}".format(sleep_n, sleep_s)
)
sleep(sleep_t)
logger.info("Yawn :] let's go!\n")
return all_following
self.instapy_session.already_liked,
self.instapy_session.commented,
self.instapy_session.followed,
self.instapy_session.already_followed,
self.instapy_session.unfollowed,
self.instapy_session.stories_watched,
self.instapy_session.reels_watched,
self.instapy_session.inap_img,
self.instapy_session.not_valid_users,
]
sessional_run_time = self.instapy_session.run_time()
run_time_info = (
"{} seconds".format(sessional_run_time)
if sessional_run_time < 60
else "{} minutes".format(truncate_float(sessional_run_time / 60, 2))
if sessional_run_time < 3600
else "{} hours".format(truncate_float(sessional_run_time / 60 / 60, 2))
)
run_time_msg = "[Session lasted {}]".format(run_time_info)
if any(stat for stat in stats):
return (
"Sessional Live Report:\n"
"|> LIKED {} images\n"
"|> ALREADY LIKED: {}\n"
"|> COMMENTED on {} images\n"
"|> FOLLOWED {} users\n"
"|> ALREADY FOLLOWED: {}\n"
"|> UNFOLLOWED {} users\n"
"|> LIKED {} comments\n"
"|> REPLIED to {} comments\n"