ly0303521

httpx关闭代理

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