Skip to content

Instantly share code, notes, and snippets.

@nkt1546789
Created March 18, 2015 05:15
Show Gist options
  • Save nkt1546789/f0a0afebf25ddd2f4753 to your computer and use it in GitHub Desktop.
Save nkt1546789/f0a0afebf25ddd2f4753 to your computer and use it in GitHub Desktop.
urlmulti.py makes url loading process faster using multiprocessing.
from multiprocessing import Pool
import requests
def urlopen(url):
try: return requests.get(url).content
except: return None
def urlsopen(urls):
pool = Pool(processes=8)
return pool.map(urlopen, urls)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment