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:
1 parent
51d057e2c9
commit
f8a47cb473
6 files changed
+93
-49
No files matched your search
@@ -31,6 +31,7 @@ from urllib.parse import urlencode
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
from .symbol_utils import crypto_base
|
||||
from .stockstats_utils import _fetch_via_ssh
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -123,8 +124,13 @@ def _fetch_subreddit_rss(
|
||||
except (OSError, http.client.HTTPException, ET.ParseError) as exc:
|
||||
# OSError covers URLError/TimeoutError/connection resets; HTTPException
|
||||
# covers chunked-transfer errors (IncompleteRead/BadStatusLine, #1024).
|
||||
logger.warning("Reddit RSS fetch failed for r/%s · %s: %s", sub, ticker, exc)
|
||||
return []
|
||||
logger.warning("Reddit RSS direct fetch failed for r/%s · %s: %s, trying SSH proxy...", sub, ticker, exc)
|
||||
try:
|
||||
proxy_data = _fetch_via_ssh(url, timeout=timeout)
|
||||
root = ET.fromstring(proxy_data.encode() if isinstance(proxy_data, str) else proxy_data)
|
||||
except Exception as proxy_exc:
|
||||
logger.warning("Reddit RSS proxy also failed for r/%s · %s: %s", sub, ticker, proxy_exc)
|
||||
return []
|
||||
|
||||
posts = []
|
||||
for entry in root.findall("atom:entry", _ATOM_NS)[:limit]:
|
||||
|
||||
Reference in new issue
Block a user