MCPcopy
hub / github.com/InstaPy/InstaPy / add_user_to_blacklist

Function add_user_to_blacklist

instapy/util.py:642–669  ·  view source on GitHub ↗
(username, campaign, action, logger, logfolder)

Source from the content-addressed store, hash-verified

640
641
642def add_user_to_blacklist(username, campaign, action, logger, logfolder):
643 file_exists = os.path.isfile("{}blacklist.csv".format(logfolder))
644 fieldnames = ["date", "username", "campaign", "action"]
645 today = datetime.date.today().strftime("%m/%d/%y")
646
647 try:
648 with open("{}blacklist.csv".format(logfolder), "a+") as blacklist:
649 writer = csv.DictWriter(blacklist, fieldnames=fieldnames)
650 if not file_exists:
651 writer.writeheader()
652 writer.writerow(
653 {
654 "date": today,
655 "username": username,
656 "campaign": campaign,
657 "action": action,
658 }
659 )
660 except Exception as err:
661 logger.error(
662 "blacklist dictWrite error \n\t{}".format(str(err).encode("utf-8"))
663 )
664
665 logger.info(
666 "--> {} added to blacklist for {} campaign (action: {})".format(
667 username, campaign, action
668 )
669 )
670
671
672def get_active_users(browser, username, posts, boundary, logger):

Callers 3

follow_userFunction · 0.85
comment_imageFunction · 0.85
like_imageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected