I\'m seeking some help logging into a gmail account and downloading some emails using a python script. I\'m trying to adapt an approach found here, but I\'m running into a p
I was able to solve this by using a text-mode browser (elinks) to verify my login from the remote server. I had already struggled a while, so I had already tried enabling unsafe apps and various other incantations.
After logging in to gmail.com in elinks (using the html-only interface and having a security code sent to my phone) I could use imaplib to access the gmail account. Presumably one must do web-authentication from the same IP one tries to use Python/imaplib from.
It's probably Better™ to use the OAuth protocol, but this way I got my script running again without rewriting it.