the get_reports
method retrieves and processes scan reports. One key challenge faced is handling null values for severity and status. When parsing report data, the method iterates through each report entry, extracting details like the creation date, status, and severity. However, in some cases, the severity and status fields may be null or empty, leading to inconsistencies in the report data
def get_reports(self):
try:
with Gmp(connection=self.connection, transform=self.transform) as gmp:
gmp.authenticate('admin', 'admin')
reports_response = gmp.get_reports(details=True) # Use details=True to get additional details
reports = []
for report in reports_response.xpath('report'):
report_dict = {
'date': report.findtext('creation_time'),
'status': report.findtext('report/status'),
'name': report.findtext('task/name'),
'severity': report.findtext('report/severity')
}
reports.append(report_dict)
return reports
except GvmError as e:
return f"An error occurred: {e}"
```can anyone help me please