Spaces:
Sleeping
Sleeping
Update api.py
Browse files
api.py
CHANGED
@@ -142,11 +142,10 @@ async def validation_exception_handler(request: Request, exc: RequestValidationE
|
|
142 |
error_details = exc.errors()
|
143 |
error_messages = []
|
144 |
for error in error_details:
|
145 |
-
loc = '->'.join(map(str, error['loc']))
|
146 |
msg = error['msg']
|
147 |
-
error_messages.append(
|
148 |
-
error_message = "; ".join(error_messages) if error_messages else "
|
149 |
-
response_json = {'urls': urls, 'scraped_texts': '', 'scrape_errors': '', 'summaries': "", 'summarizer_error': f'Error: {error_message}'}
|
150 |
json_str = json.dumps(response_json, indent=5) # convert dict to JSON str
|
151 |
return Response(content=json_str, media_type='application/json', status_code=422)
|
152 |
|
|
|
142 |
error_details = exc.errors()
|
143 |
error_messages = []
|
144 |
for error in error_details:
|
|
|
145 |
msg = error['msg']
|
146 |
+
error_messages.append(msg)
|
147 |
+
error_message = "; ".join(error_messages) if error_messages else ""
|
148 |
+
response_json = {'urls': urls, 'scraped_texts': '', 'scrape_errors': '', 'summaries': "", 'summarizer_error': f'Validation Error: {error_message}'}
|
149 |
json_str = json.dumps(response_json, indent=5) # convert dict to JSON str
|
150 |
return Response(content=json_str, media_type='application/json', status_code=422)
|
151 |
|