def login_with_persistence() -> Client:
    """Return Client logged in using saved session settings."""
    cl = Client()
    if os.path.exists(SESSION_FILE):
        cl.load_settings(SESSION_FILE)
    cl.login(IG_USERNAME, IG_PASSWORD)
    cl.dump_settings(SESSION_FILE)
    return cl
Return Client logged in using saved session settings.
examples/session_login.py