Add 404 error when no Excel found
Browse files
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"
|