INNER CODE UNIT · Python

login

wkaisertexas/tiktok-uploader · src/tiktok_uploader/auth.py:234

def login(page: Page, username: str, password: str) -> list[Cookie]:
    """
    Logs in the user using the email and password
    """
    assert username and password, "Username and password are required"

    # checks if the browser is on TikTok
    if str(config.paths.main) not in page.url:
        page.goto(str(config.paths.main))

    # checks if the user is already logged in
    # We check cookies in context
    cookies = page.context.cookies()
    session_cookie = next(
        (c for c in cookies if c["name"] == config.selectors.login.cookie_of_interest),
        None,
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…