AMSC SSL 改用 httpx.Client(verify=False) 确保跳过证书验证
This commit is contained in:
@@ -191,7 +191,8 @@ class AmscAwosSourceMixin:
|
|||||||
|
|
||||||
def _http_get_json(self, url: str, *, headers: Optional[Dict[str, str]] = None) -> Optional[Dict[str, Any]]:
|
def _http_get_json(self, url: str, *, headers: Optional[Dict[str, str]] = None) -> Optional[Dict[str, Any]]:
|
||||||
verify = os.getenv("POLYWEATHER_AMSC_SSL_VERIFY", "true").strip().lower() not in {"0", "false", "no"}
|
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)
|
with httpx.Client(verify=verify) as client:
|
||||||
|
response = client.get(url, headers=headers, timeout=getattr(self, "timeout", 10.0))
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
try:
|
try:
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|||||||
Reference in New Issue
Block a user