()
| 115 | |
| 116 | |
| 117 | def main(): |
| 118 | task_queue = Queue() |
| 119 | task_queue.put('http://m.sohu.com/') |
| 120 | spider_threads = [SpiderThread('thread-%d' % i, Spider(), task_queue) |
| 121 | for i in range(10)] |
| 122 | for spider_thread in spider_threads: |
| 123 | spider_thread.start() |
| 124 | |
| 125 | while not task_queue.empty() or is_any_alive(spider_threads): |
| 126 | sleep(5) |
| 127 | |
| 128 | print('Over!') |
| 129 | |
| 130 | |
| 131 | if __name__ == '__main__': |
no test coverage detected