diff --git a/src/data_collection/amsc_awos_sources.py b/src/data_collection/amsc_awos_sources.py index 6247670c..616ff2d0 100644 --- a/src/data_collection/amsc_awos_sources.py +++ b/src/data_collection/amsc_awos_sources.py @@ -191,7 +191,8 @@ class AmscAwosSourceMixin: 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"} - 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() try: return response.json()