Menu

#66 Modifications to work with new GALX cookie

open
nobody
None
5
2009-10-01
2009-10-01
Anonymous
No

It looks like recent changes to gmail authentication added a new cookie, GALX, that breaks libgmail login. Here's the slight modifications I made to the new login() function to deal with this change. libgmail is now working for me again! For ease of reference, I'll just post the new beginning of login(), from libgmail.py:
---
def login(self):
"""
"""
# TODO: Throw exception if we were instantiated with state?
if self.domain:
data_map = {'continue': URL_GMAIL,
'at' : 'null',
'service' : 'mail',
'Email': self.name,
'Passwd': self._pw,
}
else:
data_map = {'continue': URL_GMAIL,
'Email': self.name,
'Passwd': self._pw,
}

data = urllib.urlencode(data_map)
headers = {'Host': 'www.google.com',
'User-Agent': 'Mozilla/5.0 (Compatible; libgmail-python)'}

req = ClientCookie.Request(URL_LOGIN, data=data, headers=headers)
pageData = self._retrievePage(req)

# We need to re-fetch the page with the proper GALX value.
data_map['GALX'] = self.getCookie('GALX')
data = urllib.urlencode(data_map)
req = ClientCookie.Request(URL_LOGIN, data=data, headers=headers)
pageData = self._retrievePage(req)
---

Everything past this point is the same.

Discussion

  • Nobody/Anonymous

    Thanks a lot for posting this fix;
    I implemented your changes, and it works like a charm!

    JP

     
  • Anonymous

    Anonymous - 2009-10-15

    yes, thank you;
    also gmailftpd.py rocks like this again!
    (for today at least ;o)

     
  • Nobody/Anonymous

    It doesn't work using domains... at least for me.

     
  • Nobody/Anonymous

    It works! Nice Job!
    Thanks

     

Log in to post a comment.