From eb59ca19e46e87933423bd1cac8e14b5235e85fd Mon Sep 17 00:00:00 2001 From: Mike Dougherty Date: Mon, 13 May 2013 18:33:19 -0700 Subject: [PATCH] Put repeated auth URL in a class variable ...and added a TODO about the other ones. there seems to be conflicting information here. --- digsby/src/plugins/component_gmail/gmail.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/digsby/src/plugins/component_gmail/gmail.py b/digsby/src/plugins/component_gmail/gmail.py index dcee24a..c6f1541 100644 --- a/digsby/src/plugins/component_gmail/gmail.py +++ b/digsby/src/plugins/component_gmail/gmail.py @@ -38,10 +38,15 @@ class Gmail(EmailAccount): protocol = 'gmail' + # TODO: these variables are all used, but it's unclear if + # they should all be from the same domain (https://accounts.google.com). + # Need to audit them and see what's up. baseAuthUrl = 'https://www.google.com' authUrl = '/accounts/ClientAuth' tokenUrl = '/accounts/IssueAuthToken' + tokenAuthUrl = 'https://accounts.google.com/TokenAuth' + messageIdMatcher = re.compile(r'message_id=([a-z0-9]+?)&') jsredirectMatcher = re.compile('location\.replace\("(.*)"\)') @@ -175,7 +180,7 @@ def _external_url(self, url): if self.web_login: self.new_token(internal=False) if self.web_login and self.external_token: - return UrlQuery('https://accounts.google.com/TokenAuth?', + return UrlQuery(self.tokenAuthUrl, **{'auth':self.external_token, 'service':'mail', 'continue':url, @@ -256,7 +261,7 @@ def authenticate(self, task=None): if not token: return False - webreq_result = self.webrequest(UrlQuery('https://accounts.google.com/TokenAuth?', + webreq_result = self.webrequest(UrlQuery(self.tokenAuthUrl, **{'auth':token, 'service':'mail', 'continue':self.internalBaseMailUrl,