Files
PolyWeather/scripts/check_city_cache.py
2569718930@qq.com 9b9f548de9 从系统彻底移除 Lagos 城市
该城市已不再需要,从城市注册表、时区映射、缓存巡检脚本、测试
中全部清理。52 城市 → 51 城市。

Tested: pytest test_country_networks.py (19/19), ruff check
2026-05-21 14:30:18 +08:00

25 lines
934 B
Python

"""Check which cities have hourly / multi-model data in the analysis cache."""
import json
import urllib.request
TOK = "Bearer ZLuvwSsQvHSj2geIWfX7gjn9rJU_heOlgq0FBp7cUOgXaB2eHbE20R4PKwonP2FP"
CITIES = [
"london", "paris", "amsterdam", "helsinki", "istanbul", "ankara",
"moscow", "new york", "los angeles", "chicago", "miami", "houston",
"jeddah", "karachi", "tel aviv",
]
for city in CITIES:
url = f"http://localhost:8000/api/city/{city}/detail?force_refresh=false"
req = urllib.request.Request(url, headers={"Authorization": TOK})
try:
r = urllib.request.urlopen(req, timeout=30)
d = json.loads(r.read())
except Exception as e:
print(f"{city}: FAILED {e}")
continue
h = d.get("timeseries", {}).get("hourly", {})
m = d.get("models", {})
deb = d.get("deb", {})
print(f"{city}: hourly={len(h.get('times',[]))}p models={len(m)} deb={deb.get('prediction')}")