from crawl import XiCiProxyHelper from storage import Booter, RedisClient from detector import Detector if __name__ == "__main__": xch = XiCiProxyHelper(quantity=40, threshold=1.000) rc = RedisClient() b = Booter(rc, xch) b.run() de = Detector(rc) de.run() print('一共有{}'.format(rc.count())) rc.show() rc.remove_by_range(0, 100)
'Please input config file path(if you use default file type \'d\'.): ') if path == 'd': path = 'proxy.conf' sure = input( 'Are you sure the config file in \'{}\'. [y/n]: '.format(path)) if sure == 'y': break cfg = ConfigParser() cfg.read(path) REDIS_HOST = try_to_get_options(cfg.get, 'redis', 'host') REDIS_PORT = try_to_get_options(cfg.getint, 'redis', 'port') REDIS_PASSWORD = try_to_get_options(cfg.get, 'redis', 'password') REDIS_KEY = try_to_get_options(cfg.get, 'redis', 'key') redis_client = RedisClient(host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWORD, s_key=REDIS_KEY) count = redis_client.count() if count == 0: print('Already cleaning!') else: redis_client.show() sure = input( 'Are you sure remove that data? amount {} items! [y/n]: '.format( count)) if sure == 'y': redis_client.remove_by_range(0, 100) else: print('Good luck! Bye Bye')