import bottle from sdi_checker.libs.sdi_consistence_check.check import Check def route(app): """ Get list of items """ params = bottle.request.params url = params['url'] if 'url' in params else None check_layers = None only_err = None xunit = None xunit_output = None report_format = params['report_format'] if 'report_format' in params else 'json' timeout = params['timeout'] if 'timeout' in params else None log_level = params['log_level'] if 'log_level' in params else None log_file = params['log_file'] if 'log_file' in params else None log_clear = params['log_clear'] if 'log_clear' in params else '' # log_display = params['log_display'] if 'log_display' in params else None ssl = params['ssl'] if 'ssl' in params else '' logs_config = app.set_logs_config(level=log_level, file=log_file, clear=log_clear, display=log_display) report_output_file, report_output_format = app.get_report_output_file(name=report_name, file=report_file, extension=report_format) ssl_verify = app.get_on_off_value(value=ssl_verification, default=app.ssl_verify) check = Check() check.wms(server=url, ssl_verification=ssl_verify, check_layers=check_layers, only_err=only_err, xunit=xunit, xunit_output=xunit_output, timeout=timeout, logs=app.logs, report=app.report) # # print(app.report.errors) report = app.report.get_report(format=report_output_format) if report_output_file: with open(report_output_file, 'w') as file: file.write(report) return app._send_response(code=200, content={'success': True}, format='json') else: return app._send_response(code=200, content=report, format=report_format)