Update HBR

This commit is contained in:
Kovid Goyal 2017-08-18 22:01:11 +05:30
parent 9889b5fc7d
commit 7da08cfbd3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -34,12 +34,14 @@ class HBR(BasicNewsRecipe):
rq = Request('https://hbr.org/authenticate', headers={
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Referer': 'https://hbr.org/sign-in',
'Origin': 'https://hbr.org',
'X-Requested-With': 'XMLHttpRequest',
'Accept': 'application/json, text/javascript, */*; q=0.01',
}, data=urlencode({'username': self.username, 'password': self.password}))
r = br.open(rq)
raw = r.read()
data = json.loads(raw)
if data['code'] != 200 or data["message"] != "Authentication Successful":
if data['code'] != 200 or data["message"] != "Authentication Successful.":
raise ValueError('Failed to log in check username/password')
return br