mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Complete fix for WSJ login logic change
This commit is contained in:
parent
ac9f1fc2d9
commit
7460a12a4b
@ -112,6 +112,7 @@ class WSJ(BasicNewsRecipe):
|
||||
'sso': 'true',
|
||||
'tenant': 'sso',
|
||||
'_intstate': 'deprecated',
|
||||
'connection': 'DJldap',
|
||||
}
|
||||
for k in 'scope connection nonce state ui_locales ns protocol redirect_uri'.split():
|
||||
if k in query:
|
||||
@ -135,7 +136,12 @@ class WSJ(BasicNewsRecipe):
|
||||
'X-Remote-User': self.username
|
||||
}, data=request_query)
|
||||
self.log('Sending login request...')
|
||||
res = br.open(rq)
|
||||
try:
|
||||
res = br.open(rq)
|
||||
except Exception as err:
|
||||
if hasattr(err, 'read'):
|
||||
raise Exception('Login request failed with error: {} and body: {}'.format(err, err.read().decode('utf-8', 'replace')))
|
||||
raise
|
||||
if res.code != 200:
|
||||
raise ValueError('Failed to login, check your username and password')
|
||||
br.select_form(nr=0)
|
||||
|
@ -112,6 +112,7 @@ class WSJ(BasicNewsRecipe):
|
||||
'sso': 'true',
|
||||
'tenant': 'sso',
|
||||
'_intstate': 'deprecated',
|
||||
'connection': 'DJldap',
|
||||
}
|
||||
for k in 'scope connection nonce state ui_locales ns protocol redirect_uri'.split():
|
||||
if k in query:
|
||||
@ -135,7 +136,12 @@ class WSJ(BasicNewsRecipe):
|
||||
'X-Remote-User': self.username
|
||||
}, data=request_query)
|
||||
self.log('Sending login request...')
|
||||
res = br.open(rq)
|
||||
try:
|
||||
res = br.open(rq)
|
||||
except Exception as err:
|
||||
if hasattr(err, 'read'):
|
||||
raise Exception('Login request failed with error: {} and body: {}'.format(err, err.read().decode('utf-8', 'replace')))
|
||||
raise
|
||||
if res.code != 200:
|
||||
raise ValueError('Failed to login, check your username and password')
|
||||
br.select_form(nr=0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user