From f47ea93ec103f66aec171853ff031c9bd8d074a3 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Fri, 15 May 2026 03:47:15 +0800 Subject: [PATCH] =?UTF-8?q?AMSC=20=E9=87=8D=E5=91=BD=E5=90=8D=20=5Fhttp=5F?= =?UTF-8?q?get=5Fjson=20=E4=B8=BA=20=5Famsc=5Fhttp=5Fget=5Fjson=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=20MRO=20=E8=A2=AB=20WeatherDataCollector=20?= =?UTF-8?q?=E7=9A=84=E5=90=8C=E5=90=8D=E6=96=B9=E6=B3=95=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data_collection/amsc_awos_sources.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/data_collection/amsc_awos_sources.py b/src/data_collection/amsc_awos_sources.py index c58b4ce9..87904b9c 100644 --- a/src/data_collection/amsc_awos_sources.py +++ b/src/data_collection/amsc_awos_sources.py @@ -191,13 +191,11 @@ class AmscAwosSourceMixin: headers["app"] = "AMS" return headers - def _http_get_json(self, url: str, *, headers: Optional[Dict[str, str]] = None) -> Optional[Dict[str, Any]]: - import sys as _sys + def _amsc_http_get_json(self, url: str, *, headers: Optional[Dict[str, str]] = None) -> Optional[Dict[str, Any]]: ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE req = Request(url, headers=headers or {}) - print(f"[AMSC_DEBUG] _http_get_json called url={url[:60]}", file=_sys.stderr, flush=True) with urlopen(req, timeout=getattr(self, "timeout", 10.0), context=ctx) as resp: raw = resp.read().decode("utf-8", errors="replace") try: @@ -220,7 +218,7 @@ class AmscAwosSourceMixin: url = f"{AMSC_AWOS_BASE_URL}?cccc={quote(icao)}" started = time.perf_counter() try: - payload = self._http_get_json(url, headers=self._amsc_headers()) + payload = self._amsc_http_get_json(url, headers=self._amsc_headers()) result = _amsc_parse_wind_plate_payload( payload or {}, city_key=normalized_city,