28 comments

[ 2.2 ms ] story [ 55.7 ms ] thread
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
That's amazing, I never knew this existed, thanks!
Thank you for sharing this. I've been very interested in building my own Gmail client the past few weeks, and this looks like a nice starting point.
Didn't know the Ruby one existed, thanks for that!
My experience of the Ruby client referenced was that it was a little out of date. I was seeing errors when trying to use it a couple of weeks ago.
there are two ruby gems for Gmail, which did you use?
I actually tried both, as I remember
thank you for this. I was looking for something like this for a project I was working on
I built it because of a project I was working on :). Feel free to create an issue if you need some new features or have use cases that aren't covered.
Thank you, this is really useful.

Just when I needed it and wanted to write one you posted it. I don't think I would have done half the good job you did.

Thanks! I was working on a side project that needed to access my GMail, and I couldn't believe that a good library didn't exist already. If you find any bugs or use cases that aren't covered well, file an issue or make a contribution!
This looks pretty nice. It's really too bad that it works with a Google service.
Right, who still wants to share their data with Google?
I really wish the username/password option wasn't supported. What use cases aren't possible with OAuth?
This is great. Thank you for sharing.

I've been planning to create a Python script to help me automatically label my older emails based on content. This is a big help.

Guess I can potentially use this as a module in a tornado/Django web application for scheduling email, without having the user to sign in to gmail explicitly or opening up a separate pop-up/browser window.
Slightly off topic, but does anyone know of a similar library for Google Calendar that's any good?
This is really cool. The only thing I use gmail web interface for since I moved to mutt and IMAP, is forwarding already sent emails with large attachments to new addresses. They way I have mutt set up is that it downloads the attachment first and then sends it once per recipient. The web interface just sends it, so I wonder is there a way to duplicate that functionality with mutt or with a library like this.
Very cool - I am sure a lot of people will get good use out of it. Rather surprised nothing like this already existed.
how to get the attachment files ? i didn't see anyhting in the doc about it ... Are they in the body ?
interesting,will try it.
I knew about that. Maybe I just want a good example application to use as a reference…