קוד: |
from multiprocessing.pool import Pool import requests class testmp(): def get_page(self,url): r = requests.get(url) return r def get_data(self,urls): p=Pool() gp =lambda u : self.get_page(u) requests_iter=p.map(gp , urls) return requests_iter if __name__ == '__main__': t= testmp() boi_urls=[ "http://www.boi.org.il/he/Markets/Documents/yazigmizt.xlsx", "http://www.boi.org.il/he/Markets/Documents/yaz0106.zip", "http://www.boi.org.il/he/Markets/Documents/yaz9296.zip" ] r_itr = t.get_data(urls=boi_urls) print (list(r_itr)) |