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') == -1:
raise "Its not xml!"
else:
"""
Read the content and process
"""
...
Is this the good way to read headers ? ,as i do not want the content ,unless
it is xml.
Please suggest me,if there are some other good methods to read only the
headers.
--
Yours,
S.Selvam
--
http://mail.python.org/mailman/listinfo/python-list