Skip to content

Instantly share code, notes, and snippets.

@diogommartins
Created April 22, 2017 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diogommartins/fc7341459c7817fad39bd326c40d6e00 to your computer and use it in GitHub Desktop.
Save diogommartins/fc7341459c7817fad39bd326c40d6e00 to your computer and use it in GitHub Desktop.
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