MCPcopy
hub / github.com/InstaPy/InstaPy / post_unfollow_cleanup

Function post_unfollow_cleanup

instapy/unfollow_util.py:1440–1466  ·  view source on GitHub ↗

Casual local data cleaning after an unfollow

(
    state, username, person, relationship_data, person_id, logger, logfolder
)

Source from the content-addressed store, hash-verified

1438
1439
1440def post_unfollow_cleanup(
1441 state, username, person, relationship_data, person_id, logger, logfolder
1442):
1443 """Casual local data cleaning after an unfollow"""
1444 if not isinstance(state, list):
1445 state = [state]
1446
1447 delete_line_from_file(
1448 "{0}{1}_followedPool.csv".format(logfolder, username), person, logger
1449 )
1450
1451 if "successful" in state:
1452 if person in relationship_data[username]["all_following"]:
1453 relationship_data[username]["all_following"].remove(person)
1454
1455 if "uncertain" in state:
1456 # this user was found in our unfollow list but currently is not
1457 # being followed
1458 logtime = get_log_time()
1459 log_uncertain_unfollowed_pool(
1460 username, person, logger, logfolder, logtime, person_id
1461 )
1462 # take a generic 3 seconds of sleep per each uncertain unfollow
1463 sleep(3)
1464
1465 # save any unfollowed person
1466 log_record_all_unfollowed(username, person, logger, logfolder)
1467
1468
1469def get_buttons_from_dialog(dialog, channel):

Callers 1

unfollow_userFunction · 0.85

Calls 5

delete_line_from_fileFunction · 0.85
get_log_timeFunction · 0.85
sleepFunction · 0.85

Tested by

no test coverage detected