Created
April 22, 2017 23:51
-
-
Save diogommartins/fc7341459c7817fad39bd326c40d6e00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
from multiprocessing import Pool | |
urls = ( | |
'http://www.americanas.com', | |
'http://www.submarino.com', | |
'http://www.shoptime.com', | |
'http://www.soubarato.com', | |
) | |
def get_and_print(url): | |
response = requests.get(url) | |
print(response.text) | |
pool = Pool(processes=os.cpu_count()) | |
pool.map(get_and_print, urls) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment