From 1b71af42d7d676d771df0afed9f20cd66c0e032d Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sat, 2 May 2026 18:58:14 +0800 Subject: [PATCH] auto-sync: 2026-05-02 18:58:14 --- data_platform/fallback.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data_platform/fallback.py b/data_platform/fallback.py index 10b4bda1..d9758390 100644 --- a/data_platform/fallback.py +++ b/data_platform/fallback.py @@ -76,9 +76,11 @@ class FallbackManager: days = (datetime.strptime(end_date, "%Y-%m-%d") - datetime.strptime(start_date, "%Y-%m-%d")).days + 10 url = f"https://web.ifzq.gtimg.cn/appstock/app/fqkline/get?param={tq_symbol},day,,{days}," try: + import urllib.request, json as _json + opener = urllib.request.build_opener(urllib.request.ProxyHandler({})) req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"}) - with urllib.request.urlopen(req, timeout=10) as r: - data = json.loads(r.read()) + with opener.open(req, timeout=10) as r: + data = _json.loads(r.read()) klines = data.get("data", {}).get(tq_symbol, {}).get("day", []) if not klines: return None