ly0303521

httpx关闭代理

... ... @@ -325,7 +325,7 @@ async def startup():
global LIMITS
LIMITS = load_limits_from_config()
logger.info(f"Loaded limits: {LIMITS}")
app.state.http = httpx.AsyncClient(timeout=httpx.Timeout(REQUEST_TIMEOUT_SECONDS, connect=5.0))
app.state.http = httpx.AsyncClient(timeout=httpx.Timeout(REQUEST_TIMEOUT_SECONDS, connect=5.0), trust_env=False)
@app.on_event("shutdown")
async def shutdown(): await app.state.http.aclose()
... ... @@ -417,7 +417,7 @@ async def submit_video_job_proxy(
try:
# Use a separate client or the app state client (but need to handle multipart)
# Using separate httpx call for simplicity with files
async with httpx.AsyncClient(timeout=30.0) as client:
async with httpx.AsyncClient(timeout=30.0, trust_env=False) as client:
resp = await client.post(url, data=data, files=files)
if resp.status_code != 202 and resp.status_code != 200:
... ... @@ -443,7 +443,7 @@ async def submit_video_job_proxy(
async def get_video_status_proxy(task_id: str):
url = f"{TURBO_DIFFUSION_LOCAL_URL}/status/{task_id}"
try:
async with httpx.AsyncClient(timeout=10.0) as client:
async with httpx.AsyncClient(timeout=10.0, trust_env=False) as client:
resp = await client.get(url)
if resp.status_code == 404:
... ...