mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-04 10:46:05 +01:00
Update HBR
This commit is contained in:
parent
9889b5fc7d
commit
7da08cfbd3
1 changed files with 3 additions and 1 deletions
|
|
@ -34,12 +34,14 @@ def get_browser(self):
|
|||
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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue