Files
MoFin/archive/scripts/test_interval.py
T
知微 ccea9fcf09 cleanup: 去冗余+归档一次性脚本
- 移除重复的系统健康检查-每日(no_agent版,与LLM版重叠)
- 归档42个一次性脚本(移出MoFin/scripts→archive/scripts):
  - fix_*: 历史数据修复(11个)
  - migrate_*/rollback_*: 数据迁移(2个)
  - 一次性数据修复: bulk/close/data_freshness等(16个)
  - check_*/verify_*/diagnose_*: 历史诊断工具(12个)
  - test_*: 测试脚本(3个)
- 84个活跃脚本, 0架构违规, 31张healthy数据表
2026-07-09 00:19:00 +08:00

23 lines
869 B
Python

"""Test if steady 5s interval avoids rate limit"""
import urllib.request, json, time
UA = 'Mozilla/5.0'
codes = ['00700', '01888', '00981']
for i, code in enumerate(codes):
url = f"https://push2.eastmoney.com/api/qt/stock/get?secid=116.{code}&fields=f43,f170&fltt=2"
start = time.time()
try:
req = urllib.request.Request(url, headers={"User-Agent": UA})
with urllib.request.urlopen(req, timeout=5) as r:
resp = json.loads(r.read().decode("utf-8"))
elapsed = time.time() - start
price = resp.get('data', {}).get('f43', '?')
print(f"#{i+1} {code}: OK in {elapsed:.1f}s, price={price}")
except Exception as e:
elapsed = time.time() - start
print(f"#{i+1} {code}: FAIL in {elapsed:.1f}s — {type(e).__name__}")
break
if i < len(codes) - 1:
time.sleep(5)