Update app.py
Browse files
app.py
CHANGED
@@ -49,6 +49,10 @@ class ThreadsResponse(BaseModel):
|
|
49 |
success: bool
|
50 |
processing_time: Optional[float] = None
|
51 |
|
|
|
|
|
|
|
|
|
52 |
class ErrorResponse(BaseModel):
|
53 |
error: str
|
54 |
success: bool = False
|
@@ -231,22 +235,14 @@ def extract_media_sync(url: str) -> Dict[str, Any]:
|
|
231 |
if driver:
|
232 |
return_driver(driver)
|
233 |
|
234 |
-
@app.get("/", response_model=Dict[str, str])
|
235 |
-
async def root():
|
236 |
-
"""Root endpoint with API information"""
|
237 |
-
return {
|
238 |
-
"message": "Threads Media Extractor API v2.1 - Optimized",
|
239 |
-
"description": "Fast extraction of media URLs from Threads posts",
|
240 |
-
"version": "2.1.0",
|
241 |
-
"optimization": "Driver pooling, reduced timeouts, focused extraction"
|
242 |
-
}
|
243 |
|
244 |
-
|
|
|
245 |
async def health_check():
|
246 |
"""Health check endpoint"""
|
247 |
return {
|
248 |
"status": "healthy",
|
249 |
-
"service": "
|
250 |
"version": "2.1.0",
|
251 |
"driver_pool_size": len(driver_pool)
|
252 |
}
|
|
|
49 |
success: bool
|
50 |
processing_time: Optional[float] = None
|
51 |
|
52 |
+
class Config:
|
53 |
+
# Exclude unset fields from the response
|
54 |
+
exclude_unset = True
|
55 |
+
|
56 |
class ErrorResponse(BaseModel):
|
57 |
error: str
|
58 |
success: bool = False
|
|
|
235 |
if driver:
|
236 |
return_driver(driver)
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
+
|
240 |
+
@app.get("/")
|
241 |
async def health_check():
|
242 |
"""Health check endpoint"""
|
243 |
return {
|
244 |
"status": "healthy",
|
245 |
+
"service": "extractor",
|
246 |
"version": "2.1.0",
|
247 |
"driver_pool_size": len(driver_pool)
|
248 |
}
|