One of my scripts that uses libgmail quite suddenly started returning errors when accessing one of my accounts. It was always the following:
HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Puzzled, I did some research and found this post at the GMail Blog (http://gmailblog.blogspot.com/2007/10/code-changes-to-prepare-gmail-for.html) which mentions code changes that will probably break third party applications. Are there plans to update libgmail? I would love to get my script running again.
All I can see from using my browser to log in is that the sequence of url's has changed. There is no more "?auth=[bunch of characters]&gausr=[email]%40gmail.com" when logged in. Instead it changes quickly from "?shva=1" to "?ui=1". I am a beginner programmer, but I assume this has something to do with it?
I wrote a quick patch to get libgmail to use the old interface (attaching ?ui=1& to the end of GMAIL_URL_GMAIL).
Here are the instructions:
It's much easier to use IMAP now that Gmail supports it. You can use python's imaplib module.
from imaplib import *
# select inbox
# get all the msgs in your inbox
for uid in msgUIDs.split():
typ, mailMsg =gmailConnection.fetch(uid, '(RFC822)')
hope this helps.
I use libgmail in my gKnujOn script, the above fix (attaching ?ui=1& to the end of GMAIL_URL_GMAIL) does solve the login problem, but it doesn't fix the issue entirely. Collecting messages from the spamfolder results in listing a whole bunch (while the folder is empty) en downloading those messages results in textfiles saying "The message you requested does not exist. You might have deleted this in some other session. If you think this is a error, please report it to our <a href=http://services.google.com/inquiry/gmail_bugs?referrer=bugflow>Help Center</a>."