diff --git a/data_platform/updater.py b/data_platform/updater.py index e41fb4de..65c239d3 100644 --- a/data_platform/updater.py +++ b/data_platform/updater.py @@ -86,7 +86,8 @@ def fetch_incremental(code: str, start_date: str, end_date: str): days = (pd.Timestamp(end_date) - pd.Timestamp(start_date)).days + 10 url = f"https://web.ifzq.gtimg.cn/appstock/app/fqkline/get?param={tq},day,,{days}," import urllib.request, json - with urllib.request.urlopen(url, timeout=10) as r: + 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()) klines = data.get("data", {}).get(tq, {}).get("day", []) if not klines: