can choose store
This commit is contained in:
@@ -14,17 +14,16 @@ logger = logging.getLogger()
|
||||
logger.addHandler(logging.StreamHandler(stream=sys.stdout))
|
||||
|
||||
|
||||
def start_book(start_number, end_number, store=0):
|
||||
def start_book(start_number, end_number, store_choose_state=0, max_workers=10):
|
||||
# read the contact, and contact the 2 objects together
|
||||
excel_reader = ExcelHelper()
|
||||
contacts = excel_reader.read_contacts()[start_number - 1: end_number]
|
||||
print(contacts)
|
||||
with ThreadPoolExecutor(max_workers=1) as executor:
|
||||
logger.info(contacts)
|
||||
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
||||
for contact in contacts:
|
||||
proxy = get_proxy(contact.phone)
|
||||
commandor = CommandorPage(contact, store_type=store)
|
||||
# start the task in thread
|
||||
executor.submit(commandor.start_page, proxy)
|
||||
executor.submit(CommandorPage(contact, store_type=store_choose_state).start_page, proxy)
|
||||
|
||||
|
||||
def get_proxy(phone_number):
|
||||
@@ -41,4 +40,4 @@ def get_proxy(phone_number):
|
||||
|
||||
if __name__ == '__main__':
|
||||
# 修改联系人行,结束联系人行 第三个参数store等于0的时候是随机,传入1的时候是总店
|
||||
start_book(1, 1, store=0)
|
||||
start_book(1, 1, store_choose_state=0)
|
||||
|
||||
Reference in New Issue
Block a user