From d2cb7441a8cee956c54874e626be2fe14f386bec Mon Sep 17 00:00:00 2001 From: rofl0r Date: Fri, 11 Jan 2019 05:03:40 +0000 Subject: [PATCH] ppf: add optional debug output --- config.py | 1 + ppf.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/config.py b/config.py index fbb2115..772e5a5 100644 --- a/config.py +++ b/config.py @@ -23,6 +23,7 @@ class Config(ComboParser): self.add_item(section, 'database', str, 'websites.sqlite', 'filename of database', True) section = 'ppf' + self.add_item(section, 'debug', bool, False, 'whether to print additional debug info', False) self.add_item(section, 'search', bool, True, 'whether to use searx search engine to find new proxy lists', False) self.add_item(section, 'timeout', float, 15, 'timeout for blocking operations (connect/recv/...) for proxy checks in seconds', False) self.add_item(section, 'http_retries', int, 1, 'number of retries for http connects', False) diff --git a/ppf.py b/ppf.py index ff71c4f..8700e47 100755 --- a/ppf.py +++ b/ppf.py @@ -51,6 +51,8 @@ def fetch_contents(url): 'Accept-Language: en-US,en;q=0.8', 'Cache-Control: max-age=0', ] + if config.ppf.debug: + _log("connecting to %s..."%url, "debug") while True: proxies = [rocksock.RocksockProxyFromURL('socks4://%s' % random.choice( config.torhosts ))] http = RsHttp(host,ssl=ssl,port=port, keep_alive=True, timeout=config.ppf.timeout, max_tries=config.ppf.http_retries, follow_redirects=True, auto_set_cookies=True, proxies=proxies, user_agent='Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0')