Skip to content

Commit

Permalink
feat: option to disable SSL certificate verification
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-zippenfenig committed Aug 5, 2024
1 parent c8e2bca commit abbd9fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions openmeteo_requests/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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]:

Check failure on line 49 in openmeteo_requests/Client.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] openmeteo_requests/Client.py#L49 <501>

line too long (132 > 120 characters)
Raw output
./openmeteo_requests/Client.py:49:121: E501 line too long (132 > 120 characters)
"""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"""
Expand Down

0 comments on commit abbd9fa

Please sign in to comment.