Spaces:
Sleeping
Sleeping
Omar ID EL MOUMEN
commited on
Commit
·
8d63c3e
1
Parent(s):
6443417
Add response code on error
Browse files
app.py
CHANGED
@@ -93,7 +93,7 @@ async def extract_text_pdf(id_doc: str):
|
|
93 |
titles = re.findall(regex_titles, postprocess_text, flags=re.MULTILINE) if len(doc.get_toc()) <= 0 else doc.get_toc()
|
94 |
return {"error": False, "message": titles}
|
95 |
else:
|
96 |
-
return {"error": True}
|
97 |
|
98 |
@app.get("/extract/random/{keyword}/{limit}")
|
99 |
async def extract_random_pdf(keyword: str, limit: int):
|
|
|
93 |
titles = re.findall(regex_titles, postprocess_text, flags=re.MULTILINE) if len(doc.get_toc()) <= 0 else doc.get_toc()
|
94 |
return {"error": False, "message": titles}
|
95 |
else:
|
96 |
+
return {"error": True, "message": "Error while downloading PDF: " + str(pdf_req.status_code)}
|
97 |
|
98 |
@app.get("/extract/random/{keyword}/{limit}")
|
99 |
async def extract_random_pdf(keyword: str, limit: int):
|