Hi, I am currently writing a program that sends a HTTP get to a server and along with the HTTP response, the server sends me a XML file. What I am trying to do is to save this file. However i encountered the problem whereby the whole response message is saved. Below is an example of what was saved in the file.
<XML>....<info></info>...</XML>System.Threading.ThreadABortException:Thread was being aborted. at System.Threading. Thread.Abort(object stateinfo) at System Web. HttpResponse.End()at......
The code i used is:
Can anyone help me to either save the xml without the rest of the HTTP response msg or teach me how to retrieve the data for the element info. When I tried to real xml, I encountered error due to the unwanted information in the xml file.Code:status1, reason1, read1 = post_multipart(host, selector, fields, files) if status1 > 0: f = file(path_xml, 'wb') f.write(read1) f.close() appuifw.note(u"Query response received", "info") read_xml(path_xml) def read_xml(path_xml): print path_xml doc = ET(file=path_xml) #find the "path" element by tag name body = doc.getroot().findall("info")[0] #print body download_path = body.text print download_path download_query(download_path)
I tried google and search but could get no answer. So pls someone help me out![]()

Reply With Quote

