MCPcopy
hub / github.com/InstaPy/InstaPy / verify_username_by_id

Function verify_username_by_id

instapy/follow_util.py:96–119  ·  view source on GitHub ↗

Check if the given user has changed username after the time of followed

(browser, username, person, person_id, logger, logfolder)

Source from the content-addressed store, hash-verified

94
95
96def verify_username_by_id(browser, username, person, person_id, logger, logfolder):
97 """Check if the given user has changed username after the time of
98 followed"""
99
100 # try to find the user by ID
101 person_id = load_user_id(username, person, logger, logfolder)
102
103 # if person_id is None, inform the InstaPy user that record does not exist
104 if person_id not in [None, "unknown", "undefined"]:
105 # get the [new] username of the user from the stored user ID
106 person_new = get_username_from_id(browser, person_id, logger)
107
108 # if person_new is None, inform the InstaPy user that record does not exist
109 if person_new is not None and person_new != person:
110 logger.info(
111 "User '{}' has changed username and now is called '{}' :S".format(
112 person, person_new
113 )
114 )
115 return person_new
116
117 # check who call this def, since will receive a None value
118 logger.info("User '{}' doesn't exist in local records".format(person))
119 return None

Callers 1

get_following_statusFunction · 0.85

Calls 2

load_user_idFunction · 0.85
get_username_from_idFunction · 0.85

Tested by

no test coverage detected