Skip to content

Instantly share code, notes, and snippets.

@suminb
Last active December 14, 2015 16:19
Show Gist options
  • Save suminb/5114343 to your computer and use it in GitHub Desktop.
Save suminb/5114343 to your computer and use it in GitHub Desktop.
import multiprocessing
import requests
URLS = (
'http://50.56.81.42:8080/V0.2/favroutes-list/?userid=18',
'http://50.56.81.42:8080/V0.2/favroutes-list/?userid=4',
'http://50.56.81.42:8080/getfavadd/18',
'http://50.56.81.42:8080/getfavadd/1'
)
def fetch(url):
r = requests.get(url)
print "Fetched %s (%d bytes)" % (url, len(r.content))
p = multiprocessing.Pool(processes=4)
p.map(fetch, URLS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment