I was recently faced with a problem of downloading my Google mail using Web interface only (don't ask why POP3/IMAP was disabled).
I found a project (a library) called libgmail.py that does just what is needed. Except... Google has changed their Web interface just enough to make it not work anymore. The project at this point is abandoned as far as I can tell.
So, I have updated the library to make it work again. The update is pretty quick-and-dirty and is just enough to make it work again. You can download the updated version here: libgmail.py.
I also have some pointers on how to deal with Google's Single Sign On solution which I can share (the relevant code is not included here).
In addition to that, I wrote a little tool called GmailFetchmail.py to download messages using libgmail.py and feed them to local sendmail to be received using normal UNIX mail tools later. You can download it here: GmailFetchmail.py. The utility takes as parameters: Gmail username, Gmail password, local username (to send mail to) and, optionally, a hosted email domain.
Example:
./GmailFetchmail.py username password localuser acme.org
Disclaimer: no guarantees of usability of any kind, may lose your email, yadda, yadda, yadda.