Python ElementTree HTTP response string ParseError

pjcrfiu

New Member
I am parsing XML using element tree in python.When I parse the xml from string it works find but when I parse a string from HTTP response then I get: ParseError: no element found: line 1, column 0\[code\]params = urllib.urlencode({'service':'A','U': 'user', 'pw': 'pw'})f = urllib.urlopen("http://localhost/default.aspx?%s" % params)response = f.read()reponse_1 = """<?xml version="1.0" encoding="utf-8" ?><DATA><key id="SESSIONID">fb48b53fec5840bf9327b243d3e4f126</key></DATA>"""root = ET.fromstring(response)\[/code\]When I do:\[code\]ET.fromstring(response_1)\[/code\]It works. but when I do the same thing from HTTP respone. I get ParseError. I have checked that the response if of type 'str' and other wise looks exactly the same.Whats happening here?
 
Back
Top