All pastes #425356 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-05 13:06 UTC
rendered paste body
import pycurl,time,urllib2

contents = ""
def callback(buf):
	global contents
	contents += buf

timeNow = time.time()
req = urllib2.Request('http://www.python.org/')
response = urllib2.urlopen(req)
the_page = response.read()
print "urllib: " + time.time() - timeNow

timeNow = time.time()
c = pycurl.Curl()
c.setopt(c.URL, 'http://www.python.org/')
c.setopt(c.WRITEFUNCTION, callback)
c.perform()
c.close()
print "pycurl: " + time.time() - timeNow