Skip to content

Commit

Permalink
Merge pull request ifwe#1 from mikedougherty/master
Browse files Browse the repository at this point in the history
Put repeated auth URL in a class variable
  • Loading branch information
iliepandia committed May 14, 2013
2 parents 66b243a + eb59ca1 commit 685e636
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions digsby/src/plugins/component_gmail/gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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\("(.*)"\)')

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 685e636

Please sign in to comment.