def main (): logging.basicConfig(filename='debug.log', filemode='w') with Imap(url) as imap: imap.login(address, password) logging.info('Logged in') folders = imap.get_folders() # print('Found folders:', len(folders)) # all_uids = get_uids_and_count(imap, folders) ui = UI() # 15 - imap simultaneous connections limit tasks = [(process_messages, (folder, ui)) for folder in folders] pool = ThreadPool(max=15) pool.run(tasks, delay=1)
def comment_crawler(): pool=ThreadPool(6) for num in range(1,101):#遍历一到100页 pool.run(func=thread_get_comment,args=(num,))