feat: Add multi-source weather data collection supporting OpenWeatherMap, Visual Crossing, and NOAA METAR, and include a utility for checking MGM weather data freshness.

This commit is contained in:
2569718930@qq.com
2026-02-08 18:15:25 +08:00
parent be09c6384f
commit 3bfd1b7c7b
3 changed files with 42 additions and 7 deletions
+23
View File
@@ -0,0 +1,23 @@
import requests
import json
import time
def test_mgm(istno):
# 添加时间戳防止缓存
url = f"https://servis.mgm.gov.tr/web/sondurumlar?istno={istno}&_={int(time.time()*1000)}"
headers = {
"Origin": "https://www.mgm.gov.tr",
"User-Agent": "Mozilla/5.0"
}
try:
resp = requests.get(url, headers=headers)
if resp.status_code == 200:
data = resp.json()
print(json.dumps(data, indent=2, ensure_ascii=False))
else:
print(f"Error: {resp.status_code}")
except Exception as e:
print(f"Exception: {e}")
print("--- Station 17128 (Esenboğa) ---")
test_mgm(17128)