[ANN] libgmail 0.0.3 -- Gmail access via Python

F

Follower

libgmail -- Python binding for Google's Gmail service

<http://libgmail.sf.net/>

The `libgmail` project is a pure Python binding to provide access to
Google's Gmail web-mail service.

The library currently ships with one demonstration utility to archive
messages from a Gmail account into mbox files, suitable for importing
into a local email client.

License: GPL 2.0

Major changes since 0.0.1 & 0.0.2:

* Archive Gmail to mbox utility.

* No longer requires external ClientCookie package.

* Uses constants extracted directly from Gmail Javascript,
and includes utility to repeat the process if required.

* Code & API refactoring.

* Lazy retrieval and caching of thread and message data.

* Sourceforge project & home page.


<p><a href="http://libgmail.sf.net/">libgmail 0.0.3</a> - The
`libgmail` project is a pure Python binding to provide access to
Google's Gmail web-mail service. (08-Jul-04)</p>
 
D

David Fraser

Follower said:
libgmail -- Python binding for Google's Gmail service

<http://libgmail.sf.net/>

The `libgmail` project is a pure Python binding to provide access to
Google's Gmail web-mail service.

The library currently ships with one demonstration utility to archive
messages from a Gmail account into mbox files, suitable for importing
into a local email client.

License: GPL 2.0

Major changes since 0.0.1 & 0.0.2:

* Archive Gmail to mbox utility.

* No longer requires external ClientCookie package.

* Uses constants extracted directly from Gmail Javascript,
and includes utility to repeat the process if required.

* Code & API refactoring.

* Lazy retrieval and caching of thread and message data.

* Sourceforge project & home page.


<p><a href="http://libgmail.sf.net/">libgmail 0.0.3</a> - The
`libgmail` project is a pure Python binding to provide access to
Google's Gmail web-mail service. (08-Jul-04)</p>


This is getting really cool. One suggestion: the example on the home
page needs a libgmail in front of the GmailAccount constructor

I couldn't work out how to get the gmail.js required to update the
constants.py. Maybe being able to give username and password to
mkconstants to let it fetch the javascript would be a good idea?

Cheers
David
 
D

David Fraser

Follower said:
libgmail -- Python binding for Google's Gmail service

<http://libgmail.sf.net/>

The `libgmail` project is a pure Python binding to provide access to
Google's Gmail web-mail service.

The library currently ships with one demonstration utility to archive
messages from a Gmail account into mbox files, suitable for importing
into a local email client.

License: GPL 2.0

Major changes since 0.0.1 & 0.0.2:

* Archive Gmail to mbox utility.

* No longer requires external ClientCookie package.

* Uses constants extracted directly from Gmail Javascript,
and includes utility to repeat the process if required.

* Code & API refactoring.

* Lazy retrieval and caching of thread and message data.

* Sourceforge project & home page.


<p><a href="http://libgmail.sf.net/">libgmail 0.0.3</a> - The
`libgmail` project is a pure Python binding to provide access to
Google's Gmail web-mail service. (08-Jul-04)</p>


This is getting really cool. One suggestion: the example on the home
page needs a libgmail in front of the GmailAccount constructor

I couldn't work out how to get the gmail.js required to update the
constants.py. Maybe being able to give username and password to
mkconstants to let it fetch the javascript would be a good idea?

Cheers
David
 
F

Follower

David Fraser said:
This is getting really cool. One suggestion: the example on the home
page needs a libgmail in front of the GmailAccount constructor
Thanks for the positive feedback, David. And for revealing me as a
developer who doesn't check the sample code he puts up on his web
site. :) I appreciate you taking the time to do so and have now fixed
the page.
I couldn't work out how to get the gmail.js required to update the
constants.py. Maybe being able to give username and password to
mkconstants to let it fetch the javascript would be a good idea?
Thanks for the suggestion, I have added a function
'_retrieveJavascript' to 'GmailAccount' to assist in doing that.
Unfortunately with the last code update Gmail stopped including the
constant definitions so 'mkconstants.py' isn't much use with the
current Javascript. (*Fortunately* my, um, "friend" might have been
lucky enough to have a sav^h^h^h cached copy of a previous version...)
Of course, I understand why they did it, it knocked ~30K from the
download so it's now "only" ~230K--many of the constant names were
longer than the associated values.

The above change is only in CVS at the moment, the next release will
include it.

BTW, the latest CVS version *also* includes a SMTP server which allows
you to send messages via Gmail with any standard mail client. Python's
(until recently) undocumented `smtpd.py` SMTP server framework made
this an incredibly easy addition, although I extended it to handle
basic EHLO & AUTH user authentication commands.

Thanks again for your feedback.

--Phil.

P.S. Apologies for the delay in replying, Google Groups seems to be
delaying c.l.p the last few days.

P.P.S. Here is a (semi-edited, so probably won't run :)) chunk of
code for extending the SMTP server to ESMTP for posterity, if I don't
get around to reworking it as a patch for `smtpd.py` (it's pretty
rough, no real error checking etc...).

--- Code follows --->

import base64
import asyncore

import smtpd


class ESMTPProxy(smtpd.SMTPServer):
"""
"""

def process_message(self, peer, mailfrom, rcpttos, data):
"""
"""
# Need to process message here by subclassing...


def handle_accept(self):
conn, addr = self.accept()
print >> smtpd.DEBUGSTREAM, \
'Incoming connection from %s' % repr(addr)
channel = ESMTPChannel(self, conn, addr)


class ESMTPChannel(smtpd.SMTPChannel):
"""
"""

def smtp_EHLO(self, arg):
if not arg:
self.push('501 Syntax: EHLO hostname')
return
if self._SMTPChannel__greeting:
self.push('503 Duplicate HELO/EHLO')
else:
self._SMTPChannel__greeting = arg
self.push('250-%s' % self._SMTPChannel__fqdn)
self.push('250 AUTH LOGIN PLAIN')


def smtp_AUTH(self, arg):
"""
"""
kind, data = arg.split(" ")
# TODO: Ensure kind == "PLAIN"

data = base64.decodestring(data)[1:]
user, pw = data.split("\x00")

try:
# Try to log in here...
except:
self.push("535 Authorization failed")
else:
self.push('235 Ok')


if __name__ == "__main__":

#smtpd.DEBUGSTREAM = sys.stderr

server = ESMTPProxy(("localhost", 8025), None)

asyncore.loop()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top