self_example/Spider/Chapter10_模拟登录/大规模账号池的搭建/AccountPool/run.py

16 lines
491 B
Python

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