8000 Do not pass None as timeout to http requests (#1203) · python-kasa/python-kasa@b82743a · GitHub
[go: up one dir, main page]

Skip to content

Commit b82743a

Browse files
authored
Do not pass None as timeout to http requests (#1203)
1 parent 7483411 commit b82743a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

kasa/experimental/sslaestransport.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ def __init__(
9797
self._default_credentials: Credentials = get_default_credentials(
9898
DEFAULT_CREDENTIALS["TAPOCAMERA"]
9999
)
100-
101-
if not config.timeout:
102-
config.timeout = self.DEFAULT_TIMEOUT
103100
self._http_client: HttpClient = HttpClient(config)
104101

105102
self._state = TransportState.HANDSHAKE_REQUIRED

kasa/httpclient.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ async def post(
8989
self._last_url = url
9090
self.client.cookie_jar.clear()
9191
return_json = bool(json)
92+
if self._config.timeout is None:
93+
_LOGGER.warning("Request timeout is set to None.")
9294
client_timeout = aiohttp.ClientTimeout(total=self._config.timeout)
9395

9496
# If json is not a dict send as data.

kasa/protocol.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ def __init__(
9191
self._port = config.port_override or self.default_port
9292
self._credentials = config.credentials
9393
self._credentials_hash = config.credentials_hash
94-
self._timeout = config.timeout or self.DEFAULT_TIMEOUT
94+
if not config.timeout:
95+
config.timeout = self.DEFAULT_TIMEOUT
96+
self._timeout = config.timeout
9597

9698
@property
9799
@abstractmethod

0 commit comments

Comments
 (0)
0