Re: Reading only headers

2009-04-12 Thread Gabriel Genellina
En Thu, 09 Apr 2009 07:13:08 -0300, S.Selvam escribió: I want to read headers from web page and check whether its Content-Type is xml or not.I used the following code ... request = urllib2.Request(url, None, USER_AGENT) opener = urllib2.build_opener() datastream = opener.open(request)

Reading only headers

2009-04-09 Thread S.Selvam
Hi all, I want to read headers from web page and check whether its Content-Type is xml or not.I used the following code ... request = urllib2.Request(url, None, USER_AGENT) opener = urllib2.build_opener() datastream = opener.open(request) if datastream.headers.get('Content-Type','').find('xml