Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,13 +32,14 @@ async def proxy_request(request: Request):
|
|
| 32 |
|
| 33 |
# Use httpx to make an asynchronous GET request to the private API
|
| 34 |
try:
|
|
|
|
| 35 |
async with httpx.AsyncClient(timeout=60.0) as client:
|
| 36 |
response = await client.get(private_api_url, headers=headers)
|
| 37 |
response.raise_for_status() # Raise an exception for 4xx/5xx responses
|
| 38 |
return response.json()
|
| 39 |
|
| 40 |
-
except httpx.HTTPStatusError:
|
| 41 |
-
raise HTTPException(status_code=response.status_code, detail="Error
|
| 42 |
except httpx.RequestError as e:
|
| 43 |
raise HTTPException(status_code=500, detail=f"Network error: {str(e)}")
|
| 44 |
|
|
|
|
| 32 |
|
| 33 |
# Use httpx to make an asynchronous GET request to the private API
|
| 34 |
try:
|
| 35 |
+
print('params', encoded_params)
|
| 36 |
async with httpx.AsyncClient(timeout=60.0) as client:
|
| 37 |
response = await client.get(private_api_url, headers=headers)
|
| 38 |
response.raise_for_status() # Raise an exception for 4xx/5xx responses
|
| 39 |
return response.json()
|
| 40 |
|
| 41 |
+
except httpx.HTTPStatusError as e:
|
| 42 |
+
raise HTTPException(status_code=response.status_code, detail=f"Error: {str(e)}")
|
| 43 |
except httpx.RequestError as e:
|
| 44 |
raise HTTPException(status_code=500, detail=f"Network error: {str(e)}")
|
| 45 |
|