om4r932 commited on
Commit
91015b9
·
1 Parent(s): 7d8c704

Add 404 error when no Excel found

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -282,6 +282,9 @@ def get_change_request_dataframe(req: DataRequest):
282
  soup = BeautifulSoup(resp.text, "html.parser")
283
  files = [item.get_text() for item in soup.select("tr td a")
284
  if item.get_text().endswith(".xlsx")]
 
 
 
285
 
286
  def gen_url(tdoc: str):
287
  return f"{url}/{tdoc}.zip"
 
282
  soup = BeautifulSoup(resp.text, "html.parser")
283
  files = [item.get_text() for item in soup.select("tr td a")
284
  if item.get_text().endswith(".xlsx")]
285
+
286
+ if files == []:
287
+ raise HTTPException(status_code=404, detail="No XLSX has been found")
288
 
289
  def gen_url(tdoc: str):
290
  return f"{url}/{tdoc}.zip"