-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/14/2010 05:04 PM, Sayli Karmarkar wrote:
> 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.

There are two issues in your script:

1. URI contain a trailing '/'
2. Correct Accept header should by: 'application/xml'

But it might also work with 'text/xml'. I'll fix this very soon.
Working script:

- -----------------------

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" : "application/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()

- ------------------------

 - Michal

- --------------------------------------------------------
Michal Fojtik, [email protected], +420 532 294 4307
Ruby / Ruby On Rails Developer
Deltacloud API: http://deltacloud.org
- --------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJLxfPPAAoJEEwRP1Pf2/iqF2YH/2RWYwBZty8a9lc3qa/9xRv7
WPbOEyFQ20ApatDBK13ocWJLAjZZjznyHHWegiijI1nNUNhuY9yClL9kb5kMbtkf
tjwyNeUR1wurEBD2oIq9luRHSZCgoONHUKXywATIIhdxQGK2j7WA1REFFEvBTsOf
hosRZoIx/4UaHau6oTBBmxeM6igIJ2Ec367nm2K0pmzRjkU2vZqD/Q4IA+PzUEvB
MD3ImX+GfHYm/PW7MCyyYd19CKi3w6H9umkk5NQzRiKxu6LvDbt+Oa3rqn/X+qRH
Gk1w6PgJ2TZCFLX6FG5IhJMvqfc3NzHxhM/d2EfMpiDVrTkc2VAr7lYGCqrtCJc=
=yxI4
-----END PGP SIGNATURE-----
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to