2007
09.22

libgmail is, in words of its author, a pure python binding to provide access to your gmail account.

I’m using it and find it very useful. However, within my organization, I must connect to the internet via an HTTP/HTTPS proxy firewall. Direct internet connections are filtered, so I developed a hack to make it to work via an HTTP(S) proxied connection.

Basically I ripped the code from this ASPN snippet, and derived the urllib proxied transport to create a new one.

To use it behind a proxy, you can copy the libgmail example, and define the proxy this way:

import libgmail

libgmail.PROXY_URL = 'www.myproxy.org:3128'  # Define the proxy.

ga = libgmail.GmailAccount("google@gmail.com", "mymailismypass")
ga.login()
folder = ga.getMessagesByFolder('inbox')

for thread in folder:
    print thread.id, len(thread), thread.subject
    for msg in thread:
        print "  ", msg.id, msg.number, msg.subject
    print msg.source

I patched the libgmail.py file and write the proxied transport in another one: gmail_transport.py. You will need to copy both the file gmail_transport.py and the modified version of libgmail.py (overwrite it) into the same directory libgmail.py is installed.

There is also a diff file available, for libgmail-0.6.1.2.

Update (2007-10-06): It’s now possible to use proxy authentication. To do it so, you must use the proxy host address on the previous example this way: user:password@myproxy.org:3128 where user and password are your proxy user and password respectively. You’ll have to download again the file gmail_transport.py.

Now, the example to use it behind a proxy requiring with user/passwd authentication is like this:

import libgmail

# Connect from behind a proxy www.myproxy.org:3128 using
# proxy authentication user = 'john', password = 'proxy4321'
libgmail.PROXY_URL = 'john:proxy4321@www.myproxy.org:3128'  # Define the proxy 

ga = libgmail.GmailAccount("google@gmail.com", "mymailismypass")
ga.login()
folder = ga.getMessagesByFolder('inbox')

for thread in folder:
    print thread.id, len(thread), thread.subject
    for msg in thread:
        print "  ", msg.id, msg.number, msg.subject
    print msg.source
2007
09.09

Finally it’s over.
I officially finished the final project for my carreer. The project topic was related to parallelism, and it was entited “Dynamic Data Structures on Shared Memory. An implementation with OpenMP”. So I finally have a degree of Bachelor of Science on Computer Sciences, and avoid the horrible university studies plan about to enter in the next two years here, in Spain (which, in my opinion, degrade the level of knowledge).

A friend of mine, Khertz, came to the lecture and took this pic.

Lecture announce / Anuncio de la defensa

2007
09.06