Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions homewizard_energy/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from http import HTTPStatus
from typing import Any, TypeVar

import async_timeout
import backoff
from aiohttp.client import ClientError, ClientResponseError
from aiohttp.hdrs import METH_GET, METH_PUT
Expand Down Expand Up @@ -153,15 +152,15 @@ async def _request(
LOGGER.debug("%s, %s, %s", method, url, data)

try:
async with async_timeout.timeout(self._request_timeout):
async with asyncio.timeout(self._request_timeout):
resp = await self._session.request(
method,
url,
json=data,
headers=headers,
)
LOGGER.debug("%s, %s", resp.status, await resp.text("utf-8"))
except asyncio.TimeoutError as exception:
except TimeoutError as exception:
raise RequestError(
f"Timeout occurred while connecting to the HomeWizard Energy device at {self.host}"
) from exception
Expand Down
5 changes: 2 additions & 3 deletions homewizard_energy/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from http import HTTPStatus
from typing import Any, TypeVar

import async_timeout
import backoff
from aiohttp.client import ClientError, ClientResponseError, ClientSession
from aiohttp.hdrs import METH_DELETE, METH_GET, METH_POST, METH_PUT
Expand Down Expand Up @@ -287,7 +286,7 @@ async def _request(
LOGGER.debug("%s, %s, %s", method, url, data)

try:
async with async_timeout.timeout(self._request_timeout):
async with asyncio.timeout(self._request_timeout):
async with self._lock:
resp = await self._session.request(
method,
Expand All @@ -298,7 +297,7 @@ async def _request(
server_hostname=self._identifier,
)
LOGGER.debug("%s, %s", resp.status, await resp.text("utf-8"))
except asyncio.TimeoutError as exception:
except TimeoutError as exception:
raise RequestError(
f"Timeout occurred while connecting to the HomeWizard Energy device at {self.host}"
) from exception
Expand Down
Loading
Loading