INNER CODE UNIT · Python
login_accounts
wkaisertexas/tiktok-uploader · src/tiktok_uploader/auth.py:213
def login_accounts(
page: Page | None = None, accounts=[(None, None)], *args, **kwargs
) -> dict[str, list[Cookie]]:
"""
Authenticates the accounts using the browser backend and saves the required credentials
Keyword arguments:
- page -> the playwright page to use
- accounts -> a list of tuples of the form (username, password)
"""
page = page or get_browser(*args, **kwargs)
cookies = {}
for account in accounts:
username, password = get_username_and_password(account)
cookies[username] = login(page, username, password)