From 5c6645721202202adbf9e89bbc4da1a64b96bde0 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 25 Jul 2020 16:27:21 +0200 Subject: [PATCH] Fix debug --- get404.py | 2 +- pynyaata/connectors/core.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/get404.py b/get404.py index 6f40dc3..b2e0bea 100644 --- a/get404.py +++ b/get404.py @@ -6,7 +6,7 @@ app.config['SQLALCHEMY_ECHO'] = False links = AnimeLink.query.all() for link in links: - html = curl_content(link.link) + html = curl_content(link.link, debug=False) if html['http_code'] != 200: print('(%d) %s %s : %s' % (html['http_code'], link.title.name, link.season, link.link)) diff --git a/pynyaata/connectors/core.py b/pynyaata/connectors/core.py index 0f6e4b9..d3057f9 100644 --- a/pynyaata/connectors/core.py +++ b/pynyaata/connectors/core.py @@ -77,7 +77,7 @@ class Cache: ConnectorCache = Cache() -def curl_content(url, params=None, ajax=False): +def curl_content(url, params=None, ajax=False, debug=True): if ajax: headers = {'X-Requested-With': 'XMLHttpRequest'} else: @@ -94,7 +94,8 @@ def curl_content(url, params=None, ajax=False): except (RequestException, CloudflareException, CaptchaException) as e: output = '' http_code = 500 - getLogger().exception(e) + if debug: + getLogger().exception(e) return {'http_code': http_code, 'output': output}