Using the eventlet
library, you can patch the standard libraries for making them asynchronous.
First import the async urllib2:
from eventlet.green import urllib2
So you will get the url body with:
def fetch(url): body = urllib2.urlopen(url).read() return body
See more eventlet
examples here.