kiwiz / gkeepapi

An unofficial client for the Google Keep API.
MIT License
1.54k stars 114 forks source link

"BrowserLoginRequiredException" How to fix this bug, please help! #141

Closed l0ssl3ssn3ss closed 1 year ago

l0ssl3ssn3ss commented 1 year ago

Exception Raised

def logOn(usernm, passwd, gId):
    keep = gkeepapi.Keep()
    keep.login(f'{usernm}@gmail.com', passwd, gId) 

def logonSuccess():
    try:
        print('Intiating Logon\n')
        logOn(email, pswd, gpsId) 
        return True
    except:
        print('Error Logging')
        return False

def main():
    usrnm, pswd, gpsId = 'REDACTED', 'REDACTED', 'REDACTED' 

    if logonSuccess():
        return 'Successful Logon\nCOMPLETE - 20%\n\n'
    else:
        print('Terminating...')
        raise SystemExit

main()
l0ssl3ssn3ss commented 1 year ago
  1. The first mistake I was doing was using my main account password, using an AppPassword solved part of the problem.

  2. Making the variables as global variables seems to have also helped:

    KEEP = gkeepapi.Keep()
    SUCCESS = KEEP.login('REDACTED@gmail.com', 'AppPassword')
  3. And updating my main() accordingly:

    if SUCCESS == True:
    print('Successful Logon\nCOMPLETE - 60%\n\n')
    else:
    print('Terminating...')
    raise SystemExit