mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-13 23:14:11 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
cfca838549
commit
0c68d269a8
1 changed files with 10 additions and 0 deletions
|
|
@ -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})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue