Esempio n. 1
0
def parse_response(response_string):
    """Parse the response from an API method."""
    doc = XML(response_string)

    error_code = doc.get("errorCode")
    if error_code is not None:
        raise UCSM_XML_API_Error(doc.get("errorDescr"), error_code)

    return doc
Esempio n. 2
0
 def test_no_children(self):
     fields = {"hello": "there"}
     request_data = make_request_data("foo", fields)
     root = XML(request_data)
     self.assertEqual("foo", root.tag)
     self.assertEqual("there", root.get("hello"))
Esempio n. 3
0
 def test_no_children(self):
     fields = {'hello': 'there'}
     request_data = make_request_data('foo', fields)
     root = XML(request_data)
     self.assertEqual('foo', root.tag)
     self.assertEqual('there', root.get('hello'))