Update blackbox.py
Browse files- blackbox.py +10 -0
blackbox.py
CHANGED
@@ -283,3 +283,13 @@ class Blackbox:
|
|
283 |
except asyncio.TimeoutError:
|
284 |
logger.error(f"Request timed out. Retrying attempt {attempt + 1}/{retry_attempts}")
|
285 |
if attempt == retry_attempts - 1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
except asyncio.TimeoutError:
|
284 |
logger.error(f"Request timed out. Retrying attempt {attempt + 1}/{retry_attempts}")
|
285 |
if attempt == retry_attempts - 1:
|
286 |
+
raise HTTPException(status_code=504, detail="External API request timed out.")
|
287 |
+
except Exception as e:
|
288 |
+
logger.error(f"Unexpected error: {e}. Retrying attempt {attempt + 1}/{retry_attempts}")
|
289 |
+
if attempt == retry_attempts - 1:
|
290 |
+
raise HTTPException(status_code=500, detail=str(e))
|
291 |
+
|
292 |
+
class ImageResponse:
|
293 |
+
def __init__(self, url: str, alt: str):
|
294 |
+
self.url = url
|
295 |
+
self.alt = alt
|