(self, handler)
| 630 | handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8')) |
| 631 | |
| 632 | def serve_network_data(self, handler): |
| 633 | try: |
| 634 | latest_file = max( |
| 635 | [os.path.join(self.shared_data.scan_results_dir, f) for f in os.listdir(self.shared_data.scan_results_dir) if f.startswith('result_')], |
| 636 | key=os.path.getctime |
| 637 | ) |
| 638 | table_html = self.generate_html_table(latest_file) |
| 639 | handler.send_response(200) |
| 640 | handler.send_header("Content-type", "text/html") |
| 641 | handler.end_headers() |
| 642 | handler.wfile.write(table_html.encode('utf-8')) |
| 643 | except Exception as e: |
| 644 | handler.send_response(500) |
| 645 | handler.send_header("Content-type", "application/json") |
| 646 | handler.end_headers() |
| 647 | handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8')) |
| 648 | |
| 649 | def generate_html_table(self, file_path): |
| 650 | table_html = '<table class="styled-table"><thead><tr>' |
nothing calls this directly
no test coverage detected