MFF212 commited on
Commit
2b07ff3
·
1 Parent(s): cd6bed8

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -7
main.py CHANGED
@@ -49,18 +49,20 @@ async def upload_csv(file: UploadFile):
49
  # Calculate the percentage of redundant URLs
50
  percentage_redundant_urls = (len(redundant_urls) / total_records) * 100 if total_records > 0 else 0
51
 
52
- # Create an HTML table in the desired format
53
- html_table = "<table>"
54
- html_table += "<tr><th>GET Request</th><th>Count of Repetition</th></tr>"
55
- for url in redundant_urls:
56
- count = url_counts[url]
57
- html_table += f"<tr><td>{url}</td><td>{count}</td></tr>"
58
- html_table += "</table>"
59
 
60
  # Return both JSON and HTML responses
61
  return HTMLResponse(content=f"<h2>Analysis Results:</h2>{html_table}<br>"
62
  f"<b>Total GET Records:</b> {total_records}<br>"
63
  f"<b>% of Redundant GET Requests:</b> {round(percentage_redundant_urls, 2)}%",
64
  status_code=200)
 
 
 
 
 
 
 
 
65
  else:
66
  return {"error": "Invalid file format. Please upload a CSV file."}
 
49
  # Calculate the percentage of redundant URLs
50
  percentage_redundant_urls = (len(redundant_urls) / total_records) * 100 if total_records > 0 else 0
51
 
52
+
 
 
 
 
 
 
53
 
54
  # Return both JSON and HTML responses
55
  return HTMLResponse(content=f"<h2>Analysis Results:</h2>{html_table}<br>"
56
  f"<b>Total GET Records:</b> {total_records}<br>"
57
  f"<b>% of Redundant GET Requests:</b> {round(percentage_redundant_urls, 2)}%",
58
  status_code=200)
59
+
60
+ # Create an HTML table in the desired format
61
+ html_table = "<table>"
62
+ html_table += "<tr><th>GET Request</th><th>Count of Repetition</th></tr>"
63
+ for url in redundant_urls:
64
+ count = url_counts[url]
65
+ html_table += f"<tr><td>{url}</td><td>{count}</td></tr>"
66
+ html_table += "</table>"
67
  else:
68
  return {"error": "Invalid file format. Please upload a CSV file."}