mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 02:41:19 +02:00
use text rather than content
This commit is contained in:
parent
9160b38c3f
commit
0728dd8c6d
@ -37,7 +37,7 @@ def _get_csrf_token(content):
|
|||||||
|
|
||||||
|
|
||||||
def login(username, password):
|
def login(username, password):
|
||||||
csrf_token = _get_csrf_token(request('get', url=constant.LOGIN_URL).content)
|
csrf_token = _get_csrf_token(request('get', url=constant.LOGIN_URL).text)
|
||||||
if os.getenv('DEBUG'):
|
if os.getenv('DEBUG'):
|
||||||
logger.info('Getting CSRF token ...')
|
logger.info('Getting CSRF token ...')
|
||||||
|
|
||||||
@ -51,15 +51,15 @@ def login(username, password):
|
|||||||
}
|
}
|
||||||
resp = request('post', url=constant.LOGIN_URL, data=login_dict)
|
resp = request('post', url=constant.LOGIN_URL, data=login_dict)
|
||||||
|
|
||||||
if 'You\'re loading pages way too quickly.' in resp.content:
|
if 'You\'re loading pages way too quickly.' in resp.text:
|
||||||
csrf_token = _get_csrf_token(resp.content)
|
csrf_token = _get_csrf_token(resp.text)
|
||||||
resp = request('post', url=resp.url, data={'csrfmiddlewaretoken': csrf_token, 'next': '/'})
|
resp = request('post', url=resp.url, data={'csrfmiddlewaretoken': csrf_token, 'next': '/'})
|
||||||
|
|
||||||
if 'Invalid username/email or password' in resp.content:
|
if 'Invalid username/email or password' in resp.text:
|
||||||
logger.error('Login failed, please check your username and password')
|
logger.error('Login failed, please check your username and password')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if 'You\'re loading pages way too quickly.' in resp.content:
|
if 'You\'re loading pages way too quickly.' in resp.text:
|
||||||
logger.error('You meet challenge again, please submit a issue at https://github.com/RicterZ/nhentai/issues')
|
logger.error('You meet challenge again, please submit a issue at https://github.com/RicterZ/nhentai/issues')
|
||||||
exit(2)
|
exit(2)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user