Fix debug
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2020-07-25 16:27:21 +02:00
parent 8547976735
commit 5c66457212
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@ app.config['SQLALCHEMY_ECHO'] = False
links = AnimeLink.query.all() links = AnimeLink.query.all()
for link in links: for link in links:
html = curl_content(link.link) html = curl_content(link.link, debug=False)
if html['http_code'] != 200: if html['http_code'] != 200:
print('(%d) %s %s : %s' % (html['http_code'], link.title.name, link.season, link.link)) print('(%d) %s %s : %s' % (html['http_code'], link.title.name, link.season, link.link))

View File

@ -77,7 +77,7 @@ class Cache:
ConnectorCache = Cache() ConnectorCache = Cache()
def curl_content(url, params=None, ajax=False): def curl_content(url, params=None, ajax=False, debug=True):
if ajax: if ajax:
headers = {'X-Requested-With': 'XMLHttpRequest'} headers = {'X-Requested-With': 'XMLHttpRequest'}
else: else:
@ -94,7 +94,8 @@ def curl_content(url, params=None, ajax=False):
except (RequestException, CloudflareException, CaptchaException) as e: except (RequestException, CloudflareException, CaptchaException) as e:
output = '' output = ''
http_code = 500 http_code = 500
getLogger().exception(e) if debug:
getLogger().exception(e)
return {'http_code': http_code, 'output': output} return {'http_code': http_code, 'output': output}