mirror of
				https://github.com/RicterZ/nhentai.git
				synced 2025-11-04 02:50:55 +01:00 
			
		
		
		
	use text rather than content
This commit is contained in:
		@@ -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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user