mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update HBR
This commit is contained in:
parent
9889b5fc7d
commit
7da08cfbd3
@ -34,12 +34,14 @@ class HBR(BasicNewsRecipe):
|
|||||||
rq = Request('https://hbr.org/authenticate', headers={
|
rq = Request('https://hbr.org/authenticate', headers={
|
||||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||||
'Referer': 'https://hbr.org/sign-in',
|
'Referer': 'https://hbr.org/sign-in',
|
||||||
|
'Origin': 'https://hbr.org',
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
'Accept': 'application/json, text/javascript, */*; q=0.01',
|
||||||
}, data=urlencode({'username': self.username, 'password': self.password}))
|
}, data=urlencode({'username': self.username, 'password': self.password}))
|
||||||
r = br.open(rq)
|
r = br.open(rq)
|
||||||
raw = r.read()
|
raw = r.read()
|
||||||
data = json.loads(raw)
|
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')
|
raise ValueError('Failed to log in check username/password')
|
||||||
return br
|
return br
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user