MCPcopy Create free account
hub / github.com/ZiniuLu/Python-100-Days / main

Function main

Day66-75/code/main.py:117–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115
116
117def 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
131if __name__ == '__main__':

Callers 1

main.pyFile · 0.70

Calls 4

startMethod · 0.80
SpiderThreadClass · 0.70
SpiderClass · 0.70
is_any_aliveFunction · 0.70

Tested by

no test coverage detected