ppf: add optional debug output
This commit is contained in:
@@ -23,6 +23,7 @@ class Config(ComboParser):
|
|||||||
self.add_item(section, 'database', str, 'websites.sqlite', 'filename of database', True)
|
self.add_item(section, 'database', str, 'websites.sqlite', 'filename of database', True)
|
||||||
|
|
||||||
section = 'ppf'
|
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, '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, '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)
|
self.add_item(section, 'http_retries', int, 1, 'number of retries for http connects', False)
|
||||||
|
|||||||
2
ppf.py
2
ppf.py
@@ -51,6 +51,8 @@ def fetch_contents(url):
|
|||||||
'Accept-Language: en-US,en;q=0.8',
|
'Accept-Language: en-US,en;q=0.8',
|
||||||
'Cache-Control: max-age=0',
|
'Cache-Control: max-age=0',
|
||||||
]
|
]
|
||||||
|
if config.ppf.debug:
|
||||||
|
_log("connecting to %s..."%url, "debug")
|
||||||
while True:
|
while True:
|
||||||
proxies = [rocksock.RocksockProxyFromURL('socks4://%s' % random.choice( config.torhosts ))]
|
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')
|
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')
|
||||||
|
|||||||
Reference in New Issue
Block a user