Gvm-tools get xml report error

hi guys
i using the latest version of gvm-tools library
when i call get report function i give this error

Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/gvm/connections.py”, line 71, in _feed_xml
File “src/lxml/parser.pxi”, line 1242, in lxml.etree._FeedParser.feed
File “src/lxml/parser.pxi”, line 1364, in lxml.etree._FeedParser.feed
File “src/lxml/parser.pxi”, line 592, in lxml.etree._ParserContext._handleParseResult
File “src/lxml/parser.pxi”, line 601, in lxml.etree._ParserContext._handleParseResultDoc
File “src/lxml/parser.pxi”, line 711, in lxml.etree._handleParseResult
File “src/lxml/parser.pxi”, line 640, in lxml.etree._raiseParseError
File “”, line 1
lxml.etree.XMLSyntaxError: XML declaration allowed only at the start of the document, line 1, column 598

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/mehdi/PycharmProjects/openvas/Main2.py”, line 30, in
File “/home/mehdi/PycharmProjects/openvas/Openvas_api.py”, line 45, in report
report_id=report_id, report_format_id=report_format_id.get(report_format)
File “/usr/local/lib/python3.6/dist-packages/gvm/protocols/gmpv7.py”, line 3445, in get_report
return self._send_xml_command(cmd)
File “/usr/local/lib/python3.6/dist-packages/gvm/protocols/base.py”, line 78, in _send_xml_command
return self.send_command(xmlcmd.to_string())
File “/usr/local/lib/python3.6/dist-packages/gvm/protocols/base.py”, line 133, in send_command
raise e
File “/usr/local/lib/python3.6/dist-packages/gvm/protocols/base.py”, line 130, in send_command
response = self._read()
File “/usr/local/lib/python3.6/dist-packages/gvm/protocols/base.py”, line 55, in _read
return self._connection.read()
File “/usr/local/lib/python3.6/dist-packages/gvm/connections.py”, line 135, in read
File “/usr/local/lib/python3.6/dist-packages/gvm/connections.py”, line 76, in _feed_xml
gvm.errors.GvmError: (‘Cannot parse XML response. Response data read b’<get_reports_response status=“200” status_text=“OK”>admin2019-04-30T00:08:34Z<creation_time>2019-04-30T00:08:34Z</creation_time><modification_time>2019-04-30T00:23:42Z</modification_time>0<in_use>0</in_use><report_format id=“5057e5cc-b825-11e4-9d0e-28d24461215b”>Anonymous XML</report_format><?xml version="1.0" encoding="UTF-8"?>\n\n \n 7.0\n \n \n typeascending\n \n \n apply_overrides=0 min_qod=70 first=1 rows=1000 sort=name\n High\n Medium\n Low\n Log\n Debug\n <key’’, XMLSyntaxError(‘XML declaration allowed only at the start of the document, line 1, column 598’,))

please help me i have this problem just for xml report

It seems we are doing something wrong with XML content within the report response data. Could you create a new issue at https://github.com/greenbone/python-gvm/issues/new ? I’ll need a detailed example how to reproduce the problem.

I’ve create an issue on repository with my code and error message https://github.com/greenbone/python-gvm/issues/121
Thanks for responding

1 Like