gmail login failure using python and imaplib

前端 未结 5 2204
-上瘾入骨i
-上瘾入骨i 2020-11-30 08:37

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

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 09:13

    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.

提交回复
热议问题