Fix pylint errors
This commit is contained in:
parent
aca7019bbb
commit
407dc04b28
|
@ -1784,36 +1784,38 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
def get_password(self, callback, type_):
|
def get_password(self, callback, type_):
|
||||||
if app.config.get_per('accounts', self.name, 'anonymous_auth') and \
|
if app.config.get_per('accounts', self.name, 'anonymous_auth') and \
|
||||||
type_ != 'ANONYMOUS':
|
type_ != 'ANONYMOUS':
|
||||||
app.nec.push_incoming_event(NonAnonymousServerErrorEvent(None,
|
app.nec.push_incoming_event(
|
||||||
conn=self))
|
NonAnonymousServerErrorEvent(None, conn=self))
|
||||||
self._on_disconnected()
|
self._on_disconnected()
|
||||||
return
|
return
|
||||||
self.pasword_callback = (callback, type_)
|
self.pasword_callback = (callback, type_)
|
||||||
if type_ == 'X-MESSENGER-OAUTH2':
|
if type_ == 'X-MESSENGER-OAUTH2':
|
||||||
client_id = app.config.get_per('accounts', self.name,
|
client_id = app.config.get_per('accounts', self.name,
|
||||||
'oauth2_client_id')
|
'oauth2_client_id')
|
||||||
refresh_token = app.config.get_per('accounts', self.name,
|
refresh_token = app.config.get_per('accounts', self.name,
|
||||||
'oauth2_refresh_token')
|
'oauth2_refresh_token')
|
||||||
if refresh_token:
|
if refresh_token:
|
||||||
renew_URL = 'https://oauth.live.com/token?client_id=' \
|
renew_url = (
|
||||||
'%(client_id)s&redirect_uri=https%%3A%%2F%%2Foauth.live.' \
|
'https://oauth.live.com/token?client_id='
|
||||||
'com%%2Fdesktop&grant_type=refresh_token&refresh_token=' \
|
'%s&redirect_uri=https%%3A%%2F%%2Foauth.live.'
|
||||||
'%(refresh_token)s' % locals()
|
'com%%2Fdesktop&grant_type=refresh_token&'
|
||||||
result = helpers.download_image(self.name, {'src': renew_URL})[0]
|
'refresh_token=%s') % (client_id, refresh_token)
|
||||||
|
result = helpers.download_image(self.name, {'src': renew_url})[0]
|
||||||
if result:
|
if result:
|
||||||
dict_ = json.loads(result)
|
dict_ = json.loads(result)
|
||||||
if 'access_token' in dict_:
|
if 'access_token' in dict_:
|
||||||
self.set_password(dict_['access_token'])
|
self.set_password(dict_['access_token'])
|
||||||
return
|
return
|
||||||
script_url = app.config.get_per('accounts', self.name,
|
script_url = app.config.get_per('accounts', self.name,
|
||||||
'oauth2_redirect_url')
|
'oauth2_redirect_url')
|
||||||
token_URL = 'https://oauth.live.com/authorize?client_id=' \
|
token_url = (
|
||||||
'%(client_id)s&scope=wl.messenger%%20wl.offline_access&' \
|
'https://oauth.live.com/authorize?client_id='
|
||||||
'response_type=code&redirect_uri=%(script_url)s' % locals()
|
'%s&scope=wl.messenger%%20wl.offline_access&'
|
||||||
helpers.launch_browser_mailer('url', token_URL)
|
'response_type=code&redirect_uri=%s') % (client_id, script_url)
|
||||||
|
helpers.launch_browser_mailer('url', token_url)
|
||||||
self.disconnect(on_purpose=True)
|
self.disconnect(on_purpose=True)
|
||||||
app.nec.push_incoming_event(Oauth2CredentialsRequiredEvent(None,
|
app.nec.push_incoming_event(
|
||||||
conn=self))
|
Oauth2CredentialsRequiredEvent(None, conn=self))
|
||||||
return
|
return
|
||||||
if self.password:
|
if self.password:
|
||||||
self.set_password(self.password)
|
self.set_password(self.password)
|
||||||
|
|
Loading…
Reference in New Issue