Esempio n. 1
0
 def parse_response(self, result): 
     if result:
         try:
             result = minidom.parseString(result)
         except Exception, err:
             # This means that the result doesn't have XML, not an error
             pass
Esempio n. 2
0
 def parse_response(self, result, headers):
     """ Override's parent return value to include also include the headers """
     if result:
         try:
             result = minidom.parseString(result)
         except Exception:
             # This means that the result doesn't have XML, not an error
             pass
     return headers, result
Esempio n. 3
0
 def parse_response(self, result, headers):
     if 'content-type' in headers:
         if 'xml' in headers['content-type']:
             try:
                 return minidom.parseString(result)
             except Exception as e:
                 raise APIError('Unable to process XML data. Reason: %s' % e)
         elif 'json' in headers['content-type']:
             return super(VersionOneAPIBase, self).parse_response(result, headers)
     else:
         return result
Esempio n. 4
0
 def get_xml_from_file(self, file_name):
     raw_xml = self._read_response_file('%s.xml' % file_name)
     return minidom.parseString(raw_xml)
Esempio n. 5
0
 def parse_response(self, result, headers):
     try:
         return minidom.parseString(result)
     except Exception:
         raise VeracodeIntegrationError('Unable to process XML data: %s' % str(result)[:200])