Tomorrow
项目地址
作者madisonmay
import time import requests import sys from tomorrow import threads s=requests.Session() jishu=0 @threads(10) def download(url): global jishu for _ in range(5): try: jishu+=1 aa=s.get(url) sys.stderr.write('%s \r'%jishu) break except: pass return aa urls = ['http://p.3.cn/prices/mgets?skuIds=J_1273600']*100 if __name__ == "__main__": start = time.time() responses = [download(url) for url in urls] html = [response.text for response in responses] end = time.time() print ("Time: %f seconds" % (end - start))