AMSC AWOS 请求添加 SSL 验证开关,兼容国内证书

This commit is contained in:
2569718930@qq.com
2026-05-15 02:25:33 +08:00
parent 9868784494
commit 9f7bbffca1
+2 -1
View File
@@ -190,7 +190,8 @@ class AmscAwosSourceMixin:
return headers
def _http_get_json(self, url: str, *, headers: Optional[Dict[str, str]] = None) -> Optional[Dict[str, Any]]:
response = httpx.get(url, headers=headers, timeout=getattr(self, "timeout", 10.0))
verify = os.getenv("POLYWEATHER_AMSC_SSL_VERIFY", "true").strip().lower() not in {"0", "false", "no"}
response = httpx.get(url, headers=headers, timeout=getattr(self, "timeout", 10.0), verify=verify)
response.raise_for_status()
try:
return response.json()