MCPcopy Index your code
hub / github.com/InstaPy/InstaPy / load_user_id

Function load_user_id

instapy/util.py:1584–1613  ·  view source on GitHub ↗

Load the user ID at request from local records

(username, person, logger, logfolder)

Source from the content-addressed store, hash-verified

1582
1583
1584def load_user_id(username, person, logger, logfolder):
1585 """Load the user ID at request from local records"""
1586 pool_name = "{0}{1}_followedPool.csv".format(logfolder, username)
1587 user_id = "undefined"
1588
1589 try:
1590 with open(pool_name, "r+") as followedPoolFile:
1591 reader = csv.reader(followedPoolFile)
1592
1593 for row in reader:
1594 entries = row[0].split(" ~ ")
1595 if len(entries) < 3:
1596 # old entry which does not contain an ID
1597 pass
1598
1599 user_name = entries[1]
1600 if user_name == person:
1601 user_id = entries[2]
1602 break
1603
1604 followedPoolFile.close()
1605
1606 except BaseException as exc:
1607 logger.exception(
1608 "Failed to load the user ID of '{}'!\n\t{}".format(
1609 person, str(exc).encode("utf-8")
1610 )
1611 )
1612
1613 return user_id
1614
1615
1616def check_authorization(browser, username, method, logger, notify=True):

Callers 1

verify_username_by_idFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected