Created
April 22, 2017 23:52
-
-
Save diogommartins/0f67fb46850d830a850067288907a5c1 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.pool import ThreadPool as 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