Spaces:
Paused
Paused
211019608+kevincojean@users.noreply.github.com
commited on
fix(httpx): set custom timeout for all POST requests
Browse files
src/rotator_library/providers/antigravity_provider.py
CHANGED
|
@@ -3703,7 +3703,10 @@ class AntigravityProvider(AntigravityAuthBase, ProviderInterface):
|
|
| 3703 |
file_logger: Optional[AntigravityFileLogger] = None,
|
| 3704 |
) -> litellm.ModelResponse:
|
| 3705 |
"""Handle non-streaming completion."""
|
| 3706 |
-
response = await client.post(
|
|
|
|
|
|
|
|
|
|
| 3707 |
response.raise_for_status()
|
| 3708 |
|
| 3709 |
data = response.json()
|
|
@@ -3736,7 +3739,8 @@ class AntigravityProvider(AntigravityAuthBase, ProviderInterface):
|
|
| 3736 |
}
|
| 3737 |
|
| 3738 |
async with client.stream(
|
| 3739 |
-
"POST", url, headers=headers, json=payload,
|
|
|
|
| 3740 |
) as response:
|
| 3741 |
if response.status_code >= 400:
|
| 3742 |
# Read error body for raise_for_status to include in exception
|
|
|
|
| 3703 |
file_logger: Optional[AntigravityFileLogger] = None,
|
| 3704 |
) -> litellm.ModelResponse:
|
| 3705 |
"""Handle non-streaming completion."""
|
| 3706 |
+
response = await client.post(
|
| 3707 |
+
url, headers=headers, json=payload,
|
| 3708 |
+
timeout=httpx.Timeout(connect=30.0, read=120.0, write=120.0, pool=120.0)
|
| 3709 |
+
)
|
| 3710 |
response.raise_for_status()
|
| 3711 |
|
| 3712 |
data = response.json()
|
|
|
|
| 3739 |
}
|
| 3740 |
|
| 3741 |
async with client.stream(
|
| 3742 |
+
"POST", url, headers=headers, json=payload,
|
| 3743 |
+
timeout=httpx.Timeout(connect=30.0, read=120.0, write=120.0, pool=120.0)
|
| 3744 |
) as response:
|
| 3745 |
if response.status_code >= 400:
|
| 3746 |
# Read error body for raise_for_status to include in exception
|
src/rotator_library/providers/gemini_cli_provider.py
CHANGED
|
@@ -1965,7 +1965,7 @@ class GeminiCliProvider(GeminiAuthBase, ProviderInterface):
|
|
| 1965 |
headers=final_headers,
|
| 1966 |
json=request_payload,
|
| 1967 |
params={"alt": "sse"},
|
| 1968 |
-
timeout=
|
| 1969 |
) as response:
|
| 1970 |
# Read and log error body before raise_for_status for better debugging
|
| 1971 |
if response.status_code >= 400:
|
|
|
|
| 1965 |
headers=final_headers,
|
| 1966 |
json=request_payload,
|
| 1967 |
params={"alt": "sse"},
|
| 1968 |
+
timeout=httpx.Timeout(connect=30.0, read=120.0, write=120.0, pool=120.0),
|
| 1969 |
) as response:
|
| 1970 |
# Read and log error body before raise_for_status for better debugging
|
| 1971 |
if response.status_code >= 400:
|
src/rotator_library/providers/iflow_provider.py
CHANGED
|
@@ -492,7 +492,10 @@ class IFlowProvider(IFlowAuthBase, ProviderInterface):
|
|
| 492 |
file_logger.log_request(payload)
|
| 493 |
lib_logger.debug(f"iFlow Request URL: {url}")
|
| 494 |
|
| 495 |
-
return client.stream(
|
|
|
|
|
|
|
|
|
|
| 496 |
|
| 497 |
async def stream_handler(response_stream, attempt=1):
|
| 498 |
"""Handles the streaming response and converts chunks."""
|
|
|
|
| 492 |
file_logger.log_request(payload)
|
| 493 |
lib_logger.debug(f"iFlow Request URL: {url}")
|
| 494 |
|
| 495 |
+
return client.stream(
|
| 496 |
+
"POST", url, headers=headers, json=payload,
|
| 497 |
+
timeout=httpx.Timeout(connect=30.0, read=120.0, write=120.0, pool=120.0)
|
| 498 |
+
)
|
| 499 |
|
| 500 |
async def stream_handler(response_stream, attempt=1):
|
| 501 |
"""Handles the streaming response and converts chunks."""
|
src/rotator_library/providers/qwen_code_provider.py
CHANGED
|
@@ -503,7 +503,10 @@ class QwenCodeProvider(QwenAuthBase, ProviderInterface):
|
|
| 503 |
file_logger.log_request(payload)
|
| 504 |
lib_logger.debug(f"Qwen Code Request URL: {url}")
|
| 505 |
|
| 506 |
-
return client.stream(
|
|
|
|
|
|
|
|
|
|
| 507 |
|
| 508 |
async def stream_handler(response_stream, attempt=1):
|
| 509 |
"""Handles the streaming response and converts chunks."""
|
|
|
|
| 503 |
file_logger.log_request(payload)
|
| 504 |
lib_logger.debug(f"Qwen Code Request URL: {url}")
|
| 505 |
|
| 506 |
+
return client.stream(
|
| 507 |
+
"POST", url, headers=headers, json=payload,
|
| 508 |
+
timeout=httpx.Timeout(connect=30.0, read=120.0, write=120.0, pool=120.0)
|
| 509 |
+
)
|
| 510 |
|
| 511 |
async def stream_handler(response_stream, attempt=1):
|
| 512 |
"""Handles the streaming response and converts chunks."""
|