From 0c68d269a8c79de90095cd75561fe0a0c4451b19 Mon Sep 17 00:00:00 2001 From: imoes Date: Thu, 16 Apr 2026 20:23:24 +0200 Subject: [PATCH] fix: pass HTTP proxy env vars to Tencent Cloud SDK in sougou.py The Tencent Cloud SDK (tencentcloud-sdk-python) does not automatically read http_proxy/https_proxy environment variables, unlike the standard requests library used by all other search providers. Without an explicit HttpProfile.proxy setting, Sougou search bypasses the corporate proxy. Fix: read proxy from all four env var variants and set HttpProfile.proxy when a proxy is present, matching the pattern used in duckduckgo.py. Co-Authored-By: Claude Sonnet 4.6 --- backend/open_webui/retrieval/web/sougou.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/open_webui/retrieval/web/sougou.py b/backend/open_webui/retrieval/web/sougou.py index b267374d79..52b1d91731 100644 --- a/backend/open_webui/retrieval/web/sougou.py +++ b/backend/open_webui/retrieval/web/sougou.py @@ -1,5 +1,6 @@ import logging import json +import os from typing import Optional, List @@ -27,6 +28,15 @@ def search_sougou( cred = credential.Credential(sougou_api_sid, sougou_api_sk) http_profile = HttpProfile() http_profile.endpoint = 'tms.tencentcloudapi.com' + # Tencent Cloud SDK does not read proxy env vars automatically + proxy = ( + os.environ.get("https_proxy") + or os.environ.get("HTTPS_PROXY") + or os.environ.get("http_proxy") + or os.environ.get("HTTP_PROXY") + ) + if proxy: + http_profile.proxy = proxy client_profile = ClientProfile() client_profile.http_profile = http_profile params = json.dumps({'Query': query, 'Cnt': 20})