5 ms·
You can also retrieve the password from your system keyring[1] import keyring pass_is = keyring.get_password('gmail', 'whatever@gmail.com') you set i
by spindritf 13y ago
You can also retrieve the password from your system keyring[1]
import keyring
pass_is = keyring.get_password('gmail', 'whatever@gmail.com')
you set it with
set_password(servicename, username, password)
so
set_password('gmail', 'whatever@gmail.com', 'one of those per app passwords if you use 2factor for example')
[1] https://pypi.python.org/pypi/keyring https://pypi.python.org/pypi/keyring
- codezero 13y agoThat's amazing, I never knew this existed, thanks!
- grinich 13y agoEven better, use oauth2 tokens instead of your username/password. Here's a script to generate them: https://google-mail-oauth2-tools.googlecode.com/svn/trunk/python/oauth2.py https://google-mail-oauth2-tools.googlecode.com/svn/trunk/py...