Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SSL Regression #16

Merged
merged 10 commits into from
Aug 11, 2024
12 changes: 5 additions & 7 deletions pydaikin/daikin_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Appliance(DaikinPowerMixin): # pylint: disable=too-many-public-methods
"""Daikin main appliance class."""

base_url: str
headers: Optional[dict] = None
headers: dict = {}
session: Optional[ClientSession]
ssl_context: Optional[SSLContext] = None

Expand Down Expand Up @@ -135,19 +135,17 @@ async def _get_resource(self, path: str, params: Optional[dict] = None):
if params is None:
params = {}

headers = self.headers
if headers is None:
headers = {}

_LOGGER.debug("Calling: %s/%s %s [%s]", self.base_url, path, params, headers)
_LOGGER.debug(
"Calling: %s/%s %s [%s]", self.base_url, path, params, self.headers
)

# cannot manage session on outer async with or this will close the session
# passed to pydaikin (homeassistant for instance)
async with self.request_semaphore:
async with self.session.get(
f'{self.base_url}/{path}',
params=params,
headers=headers,
headers=self.headers,
ssl_context=self.ssl_context,
) as response:
if response.status == 403:
Expand Down
Loading