.map()是指并行运行多个URL的检索,并且确实会等待这些任务完成(
gevent.joinall(jobs))被调用。
使用
.send(),而不是产卵的工作,使用
Pool实例:
req = grequests.get('http://www.prehenge.net/blog', hooks=dict(response=print_res))job = grequests.send(req, grequests.Pool(1))for i in range(10): print i
没有池,
.send()调用将仍然阻塞,但仅针对
gevent.spawn()执行的调用。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)