From: Ed Page Date: Fri, 2 Oct 2009 00:46:06 +0000 (-0500) Subject: Applying a fix for some peoples login issue X-Git-Url: http://git.maemo.org/git/?p=theonering;a=commitdiff_plain;h=b327a25a278942986e99241231b4dc52a254f271 Applying a fix for some peoples login issue --- diff --git a/src/gvoice/backend.py b/src/gvoice/backend.py index b578445..b091153 100755 --- a/src/gvoice/backend.py +++ b/src/gvoice/backend.py @@ -143,13 +143,23 @@ class GVoiceBackend(object): self._lastAuthed = time.time() return True + _tokenURL = "http://www.google.com/voice/m" _loginURL = "https://www.google.com/accounts/ServiceLoginAuth" + _galxRe = re.compile(r"""""", re.MULTILINE | re.DOTALL) def login(self, username, password): """ Attempt to login to GoogleVoice @returns Whether login was successful or not """ + try: + tokenPage = self._browser.download(self._tokenURL) + except urllib2.URLError, e: + _moduleLogger.exception("Translating error: %s" % str(e)) + raise NetworkError("%s is not accesible" % self._loginURL) + galxTokens = self._galxRe.search(tokenPage) + galxToken = galxTokens.group(1) + loginPostData = urllib.urlencode({ 'Email' : username, 'Passwd' : password, @@ -157,6 +167,7 @@ class GVoiceBackend(object): "ltmpl": "mobile", "btmpl": "mobile", "PersistentCookie": "yes", + "GALX": galxToken, "continue": self._forwardURL, })