Hi,

Is something changed about the format of deltacloud api response recently? After updating core yesterday, my scripts which used to work fine before seem to be throwing following traceback when trying to parse xml response using python minidom.

Traceback (most recent call last):
File "test_api.py", line 21, in ?
  xmldoc = minidom.parse(response)
File "/usr/lib/python2.4/site-packages/_xmlplus/dom/minidom.py", line 1915, in parse
  return expatbuilder.parse(file)
File "/usr/lib/python2.4/site-packages/_xmlplus/dom/expatbuilder.py", line 930, in parse
  result = builder.parseFile(file)
File "/usr/lib/python2.4/site-packages/_xmlplus/dom/expatbuilder.py", line 207, in parseFile
  parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: mismatched tag: line 19, column 2

I have attached a small test script that reproduces the problem.

Thanks,

--
Sayli Karmarkar
[email protected]

Systems Management
http://www.redhat.com

from xml.dom import minidom
import httplib

host = '0.0.0.0'
port = 3001
apihandler = "/api"

method = '/realms/'

request_type = "GET"
headers = { "Content-Type" : "application/x-www-form-urlencoded",
                         "Accept" : "text/xml"}

handler = apihandler + method

conn = httplib.HTTPConnection(host, port)
conn.request(request_type, handler, body=None, headers=headers)
response = conn.getresponse()
print response   

xmldoc = minidom.parse(response)
print xmldoc
print xmldoc.toxml()


_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to