Spaces:
Build error
Build error
Commit
·
319a5e7
1
Parent(s):
49c93c0
test connection
Browse files- app/main.py +15 -0
app/main.py
CHANGED
@@ -169,6 +169,21 @@ async def test_connection():
|
|
169 |
raise HTTPException(status_code=e.response.status_code, detail=e.response.text)
|
170 |
except Exception as e:
|
171 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
@app.post("/load_file")
|
174 |
async def load_file_with_markitdown(file_path: str, llm_client: str = None, model: str = None):
|
|
|
169 |
raise HTTPException(status_code=e.response.status_code, detail=e.response.text)
|
170 |
except Exception as e:
|
171 |
raise HTTPException(status_code=500, detail=str(e))
|
172 |
+
|
173 |
+
@app.get("/test_other_connection")
|
174 |
+
async def test_other_connection():
|
175 |
+
url = "https://www.google.com"
|
176 |
+
try:
|
177 |
+
async with httpx.AsyncClient(timeout=10) as client:
|
178 |
+
response = await client.get(url)
|
179 |
+
response.raise_for_status()
|
180 |
+
return {"status": "success", "data": response.text[:200]} # Return first 200 chars
|
181 |
+
except httpx.ConnectTimeout:
|
182 |
+
raise HTTPException(status_code=504, detail="Connection timed out.")
|
183 |
+
except httpx.HTTPStatusError as e:
|
184 |
+
raise HTTPException(status_code=e.response.status_code, detail=e.response.text)
|
185 |
+
except Exception as e:
|
186 |
+
raise HTTPException(status_code=500, detail=str(e))
|
187 |
|
188 |
@app.post("/load_file")
|
189 |
async def load_file_with_markitdown(file_path: str, llm_client: str = None, model: str = None):
|