Does urllib2
fetch the whole page when a urlopen
call is made?
I'd like to just read the HTTP response header without getting the page. It looks like urllib2
opens the HTTP connection and then subsequently gets the actual HTML page... or does it just start buffering the page with the urlopen
call?
import urllib2
myurl = 'http://www.kidsidebyside.org/2009/05/come-and-draw-the-circle-of-unity-with-us/'
page = urllib2.urlopen(myurl) // open connection, get headers
html = page.readlines() // stream page
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…