diff --git a/config.py b/config.py index 1a979c2..836b4ed 100644 --- a/config.py +++ b/config.py @@ -8,20 +8,23 @@ class Config(ComboParser): self.servers = [x.strip() for x in handle.readlines() if len(x.strip()) > 0] def __init__(self): super(Config, self).__init__('config.ini') - self.add_item('common', 'tor_hosts', str, '127.0.0.1:9050', 'comma-separated list of tor proxy address(es)', True) - self.add_item('common', 'database', str, 'proxylist.sqlite', 'filename of database', True) + section = 'common' + self.add_item(section, 'tor_hosts', str, '127.0.0.1:9050', 'comma-separated list of tor proxy address(es)', True) + self.add_item(section, 'database', str, 'proxylist.sqlite', 'filename of database', True) - self.add_item('watchd', 'max_fail', int, 5, 'number of fails after which a proxy is considered dead', False) - self.add_item('watchd', 'threads', int, 10, 'number of threads watchd uses to check proxies', True) - self.add_item('watchd', 'timeout', int, 15, 'timeout for blocking operations (connect/recv/...) for proxy checks in seconds', False) - self.add_item('watchd', 'submit_after', int, 200, 'min. number of tested proxies for DB write', False) - self.add_item('watchd', 'debug', bool, False, 'whether to print additional debug info', False) - self.add_item('watchd', 'use_ssl', bool, False, 'whether to use SSL and port 6697 to connect to targets (slower)', False) - self.add_item('watchd', 'checktime', int, 1800, 'base checking interval for proxies in db in seconds', False) - self.add_item('watchd', 'perfail_checktime', int, 3600, 'additional checking interval for proxies in db in seconds per experienced failure', False) + section = 'watchd' + self.add_item(section, 'max_fail', int, 5, 'number of fails after which a proxy is considered dead', False) + self.add_item(section, 'threads', int, 10, 'number of threads watchd uses to check proxies', True) + self.add_item(section, 'timeout', int, 15, 'timeout for blocking operations (connect/recv/...) for proxy checks in seconds', False) + self.add_item(section, 'submit_after', int, 200, 'min. number of tested proxies for DB write', False) + self.add_item(section, 'debug', bool, False, 'whether to print additional debug info', False) + self.add_item(section, 'use_ssl', bool, False, 'whether to use SSL and port 6697 to connect to targets (slower)', False) + self.add_item(section, 'checktime', int, 1800, 'base checking interval for proxies in db in seconds', False) + self.add_item(section, 'perfail_checktime', int, 3600, 'additional checking interval for proxies in db in seconds per experienced failure', False) - self.add_item('ppf', 'search', bool, True, 'whether to use searx search engine to find new proxy lists', False) - self.add_item('ppf', 'timeout', float, 15, 'timeout for blocking operations (connect/recv/...) for proxy checks in seconds', False) - self.add_item('ppf', 'http_retries', int, 1, 'number of retries for http connects', False) - self.add_item('ppf', 'checktime', int, 3600, 'base checking interval for urls in db in seconds', False) - self.add_item('ppf', 'perfail_checktime', int, 3600, 'additional checking interval for urls in db in seconds per experienced failure', False) + section = 'ppf' + 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) + self.add_item(section, 'checktime', int, 3600, 'base checking interval for urls in db in seconds', False) + self.add_item(section, 'perfail_checktime', int, 3600, 'additional checking interval for urls in db in seconds per experienced failure', False)