feat: 全面SSH中转代理 + mimo-v2.5-pro支持

- Yahoo Finance: 跳过本地限流,直接走SSH中转
- StockTwits: 直连403时自动fallback到SSH中转
- Reddit: 网络不可达时自动fallback到SSH中转
- Polymarket: 网络不可达时自动fallback到SSH中转
- FRED: 配置API Key (825283926dd016ea66e96cc919e047da)
- .env: 新增FRED_API_KEY和OPENAI_COMPATIBLE_API_KEY
- test_xiaomi.py: 小米mimo-v2.5-pro测试脚本
This commit is contained in:
小钰 committed 2026-07-08 11:26:03 +08:00
1 parent 51d057e2c9
commit f8a47cb473
6 files changed
+93 -49

No files matched your search

+8 -2
View File
@@ -20,6 +20,7 @@ import logging
from urllib.request import Request, urlopen
from .symbol_utils import crypto_base
from .stockstats_utils import _fetch_via_ssh
logger = logging.getLogger(__name__)
@@ -54,8 +55,13 @@ def fetch_stocktwits_messages(ticker: str, limit: int = 30, timeout: float = 10.
except (OSError, http.client.HTTPException, json.JSONDecodeError) as exc:
# OSError covers URLError/TimeoutError/connection resets; HTTPException
# covers chunked-transfer errors (IncompleteRead/BadStatusLine, #1024).
logger.warning("StockTwits fetch failed for %s: %s", ticker, exc)
return f"<stocktwits unavailable: {type(exc).__name__}>"
logger.warning("StockTwits direct fetch failed for %s: %s, trying SSH proxy...", ticker, exc)
try:
proxy_data = _fetch_via_ssh(url, timeout=timeout)
data = json.loads(proxy_data)
except Exception as proxy_exc:
logger.warning("StockTwits proxy also failed for %s: %s", ticker, proxy_exc)
return f"<stocktwits unavailable: {type(exc).__name__}>"
messages = data.get("messages", []) if isinstance(data, dict) else []
if not messages: