Skip to content

Commit 6b76233

Browse files
committed
Implement ClientSession-related suggestion
1 parent 005c4e9 commit 6b76233

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

plugwise/smilecomm.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
from __future__ import annotations
77

8-
import asyncio
9-
108
from plugwise.constants import LOGGER
119
from plugwise.exceptions import (
1210
ConnectionFailedError,
@@ -36,17 +34,7 @@ def __init__(
3634
"""Set the constructor for this class."""
3735
if not websession:
3836
aio_timeout = ClientTimeout(total=timeout)
39-
40-
async def _create_session() -> ClientSession:
41-
return ClientSession(timeout=aio_timeout) # pragma: no cover
42-
43-
loop = asyncio.get_event_loop()
44-
if loop.is_running():
45-
self._websession = ClientSession(timeout=aio_timeout)
46-
else:
47-
self._websession = loop.run_until_complete(
48-
_create_session()
49-
) # pragma: no cover
37+
self._websession = ClientSession(timeout=aio_timeout)
5038
else:
5139
self._websession = websession
5240

0 commit comments

Comments
 (0)