I’m investigating the possibility of making a single http request using python to retrieve both the html as well as http headers info instead of having to make 2 seperate calls.
Anyone know of any good ways?
Also what is the performance differences between the different methods of making these requests, e.g. urllib2 and httpconnection, etc.
Just use
urllib2.urlopen(). The HTML can be retrieved by calling theread()method of the returned object, and the headers are available in theheadersattribute.