This commit is contained in:
Ricter Z 2018-08-11 09:24:16 +08:00
parent de157ccb7f
commit 4577e9df9a

View File

@ -27,7 +27,7 @@ def login_parser(username, password):
s.get(constant.LOGIN_URL) s.get(constant.LOGIN_URL)
content = s.get(constant.LOGIN_URL).content content = s.get(constant.LOGIN_URL).content
html = BeautifulSoup(content, 'html.parser').encode("ascii") html = BeautifulSoup(content, 'html.parser')
csrf_token_elem = html.find('input', attrs={'name': 'csrfmiddlewaretoken'}) csrf_token_elem = html.find('input', attrs={'name': 'csrfmiddlewaretoken'})
if not csrf_token_elem: if not csrf_token_elem:
@ -44,7 +44,7 @@ def login_parser(username, password):
logger.error('Login failed, please check your username and password') logger.error('Login failed, please check your username and password')
exit(1) exit(1)
html = BeautifulSoup(s.get(constant.FAV_URL).content, 'html.parser').encode("ascii") html = BeautifulSoup(s.get(constant.FAV_URL).content, 'html.parser')
count = html.find('span', attrs={'class': 'count'}) count = html.find('span', attrs={'class': 'count'})
if not count: if not count:
logger.error('Cannot get count of your favorites, maybe login failed.') logger.error('Cannot get count of your favorites, maybe login failed.')