py3: Fix login checks in various recipes

This commit is contained in:
Kovid Goyal 2019-05-18 18:55:02 +05:30
parent 1de94d39e2
commit 96a8aeaaf5
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
7 changed files with 7 additions and 7 deletions

View File

@ -68,7 +68,7 @@ class DiscoverMagazine(BasicNewsRecipe):
res = br.open('http://discovermagazine.com') res = br.open('http://discovermagazine.com')
br.set_debug_http(False) br.set_debug_http(False)
raw = res.read() raw = res.read()
if '>Logout<' not in raw: if b'>Logout<' not in raw:
raise ValueError('Failed to login') raise ValueError('Failed to login')
return br return br

View File

@ -29,7 +29,7 @@ class insider(BasicNewsRecipe):
br['login-password'] = self.password br['login-password'] = self.password
res = br.submit() res = br.submit()
raw = res.read() raw = res.read()
if u'Odhlásit se' not in raw: if b'Odhlásit se' not in raw:
raise ValueError('Failed to login to insider.cz' raise ValueError('Failed to login to insider.cz'
'Check your username and password.') 'Check your username and password.')
return br return br

View File

@ -42,7 +42,7 @@ class JASN(BasicNewsRecipe):
br['code'] = self.password br['code'] = self.password
response = br.submit() response = br.submit()
raw = response.read() raw = response.read()
if 'Sign Out' not in raw: if b'Sign Out' not in raw:
raise ValueError('Failed to log in, is your account expired?') raise ValueError('Failed to log in, is your account expired?')
return br return br

View File

@ -33,7 +33,7 @@ class LeTemps(BasicNewsRecipe):
br['name'] = self.username br['name'] = self.username
br['pass'] = self.password br['pass'] = self.password
raw = br.submit().read() raw = br.submit().read()
if 'href="/subscribe"' in raw: if b'href="/subscribe"' in raw:
raise ValueError( raise ValueError(
'Failed to login to letemps.ch. Check ' 'Failed to login to letemps.ch. Check '
'your username and password' 'your username and password'

View File

@ -75,7 +75,7 @@ class DailyTelegraph(BasicNewsRecipe):
br['username'] = self.username br['username'] = self.username
br['password'] = self.password br['password'] = self.password
raw = br.submit().read() raw = br.submit().read()
if '>log out' not in raw.lower(): if b'>log out' not in raw.lower():
raise ValueError('Failed to log in to www.heralsun' raise ValueError('Failed to log in to www.heralsun'
' are your username and password correct?') ' are your username and password correct?')
return br return br

View File

@ -41,7 +41,7 @@ class NRCNext(BasicNewsRecipe):
br['password'] = self.password br['password'] = self.password
response2 = br.submit() response2 = br.submit()
raw = response2.get_data() raw = response2.get_data()
if 'niet ingelogd' in raw: # in body class if b'niet ingelogd' in raw: # in body class
raise ValueError('Failed to login, check username and password') raise ValueError('Failed to login, check username and password')
epubraw = None epubraw = None
for today in (date.today(), date.today() - timedelta(days=1),): for today in (date.today(), date.today() - timedelta(days=1),):

View File

@ -32,7 +32,7 @@ class TNR(BasicNewsRecipe):
br['pass'] = self.password br['pass'] = self.password
self.log('Logging in...') self.log('Logging in...')
raw = br.submit().read() raw = br.submit().read()
if 'SIGN OUT' not in raw: if b'SIGN OUT' not in raw:
raise ValueError( raise ValueError(
'Failed to log in to tnr.com, check your username and password') 'Failed to log in to tnr.com, check your username and password')
self.log('Logged in successfully') self.log('Logged in successfully')