From abbd9fa90ea6e198a0a74b7c322bb8a79324044a Mon Sep 17 00:00:00 2001 From: patrick-zippenfenig Date: Mon, 5 Aug 2024 17:42:25 +0200 Subject: [PATCH 1/4] feat: option to disable SSL certificate verification --- openmeteo_requests/Client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openmeteo_requests/Client.py b/openmeteo_requests/Client.py index d12c16d..f6bb80a 100644 --- a/openmeteo_requests/Client.py +++ b/openmeteo_requests/Client.py @@ -21,13 +21,13 @@ class Client: def __init__(self, session: TSession | None = None): self.session = session or requests.Session() - def _get(self, cls: type[T], url: str, params: any, method: str) -> list[T]: + def _get(self, cls: type[T], url: str, params: any, method: str, verify: bool | str | None) -> list[T]: params["format"] = "flatbuffers" if method.upper() == "POST": - response = self.session.request("POST", url, data=params) + response = self.session.request("POST", url, data=params, verify=verify) else: - response = self.session.request("GET", url, params=params) + response = self.session.request("GET", url, params=params, verify=verify) if response.status_code in [400, 429]: response_body = response.json() @@ -46,9 +46,9 @@ def _get(self, cls: type[T], url: str, params: any, method: str) -> list[T]: pos += length + 4 return messages - def weather_api(self, url: str, params: any, method: str = "GET") -> list[WeatherApiResponse]: + def weather_api(self, url: str, params: any, method: str = "GET", verify: bool | str | None = None) -> list[WeatherApiResponse]: """Get and decode as weather api""" - return self._get(WeatherApiResponse, url, params, method) + return self._get(WeatherApiResponse, url, params, method, verify) def __del__(self): """cleanup""" From 4ffef19d9432925347e35aac6e91240c109f72da Mon Sep 17 00:00:00 2001 From: Patrick Zippenfenig Date: Mon, 5 Aug 2024 17:45:37 +0200 Subject: [PATCH 2/4] Update openmeteo_requests/Client.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- openmeteo_requests/Client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openmeteo_requests/Client.py b/openmeteo_requests/Client.py index f6bb80a..5e4a548 100644 --- a/openmeteo_requests/Client.py +++ b/openmeteo_requests/Client.py @@ -46,7 +46,9 @@ def _get(self, cls: type[T], url: str, params: any, method: str, verify: bool | pos += length + 4 return messages - def weather_api(self, url: str, params: any, method: str = "GET", verify: bool | str | None = None) -> list[WeatherApiResponse]: + def weather_api( + self, url: str, params: any, method: str = "GET", verify: bool | str | None = None + ) -> list[WeatherApiResponse]: """Get and decode as weather api""" return self._get(WeatherApiResponse, url, params, method, verify) From 4d7ea9bb0efdeac1b599038b41badcf8d8ec48b9 Mon Sep 17 00:00:00 2001 From: patrick-zippenfenig Date: Mon, 5 Aug 2024 17:51:31 +0200 Subject: [PATCH 3/4] pylint: disable=too-many-arguments --- openmeteo_requests/Client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openmeteo_requests/Client.py b/openmeteo_requests/Client.py index 5e4a548..165007d 100644 --- a/openmeteo_requests/Client.py +++ b/openmeteo_requests/Client.py @@ -21,6 +21,7 @@ class Client: def __init__(self, session: TSession | None = None): self.session = session or requests.Session() + #pylint: disable=too-many-arguments def _get(self, cls: type[T], url: str, params: any, method: str, verify: bool | str | None) -> list[T]: params["format"] = "flatbuffers" From c3f13e74e2489140af1927fc36a053d57404f862 Mon Sep 17 00:00:00 2001 From: Patrick Zippenfenig Date: Mon, 5 Aug 2024 17:53:41 +0200 Subject: [PATCH 4/4] Update openmeteo_requests/Client.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- openmeteo_requests/Client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmeteo_requests/Client.py b/openmeteo_requests/Client.py index 165007d..bb9d4be 100644 --- a/openmeteo_requests/Client.py +++ b/openmeteo_requests/Client.py @@ -21,7 +21,7 @@ class Client: def __init__(self, session: TSession | None = None): self.session = session or requests.Session() - #pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments def _get(self, cls: type[T], url: str, params: any, method: str, verify: bool | str | None) -> list[T]: params["format"] = "flatbuffers"