self_example/Spider/Chapter09_代理的使用/代理池的维护/ProxyPool/run.py

15 lines
394 B
Python

from proxypool.scheduler import Scheduler
import argparse
parser = argparse.ArgumentParser(description='ProxyPool')
parser.add_argument('--processor', type=str, help='processor to run')
args = parser.parse_args()
if __name__ == '__main__':
# if processor set, just run it
if args.processor:
getattr(Scheduler(), f'run_{args.processor}')()
else:
Scheduler().run()