diff --git a/kasa/experimental/sslaestransport.py b/kasa/experimental/sslaestransport.py index eddc6698..68420f89 100644 --- a/kasa/experimental/sslaestransport.py +++ b/kasa/experimental/sslaestransport.py @@ -97,9 +97,6 @@ class SslAesTransport(BaseTransport): self._default_credentials: Credentials = get_default_credentials( DEFAULT_CREDENTIALS["TAPOCAMERA"] ) - - if not config.timeout: - config.timeout = self.DEFAULT_TIMEOUT self._http_client: HttpClient = HttpClient(config) self._state = TransportState.HANDSHAKE_REQUIRED diff --git a/kasa/httpclient.py b/kasa/httpclient.py index 9904b17b..6b8e234c 100644 --- a/kasa/httpclient.py +++ b/kasa/httpclient.py @@ -89,6 +89,8 @@ class HttpClient: self._last_url = url self.client.cookie_jar.clear() return_json = bool(json) + if self._config.timeout is None: + _LOGGER.warning("Request timeout is set to None.") client_timeout = aiohttp.ClientTimeout(total=self._config.timeout) # If json is not a dict send as data. diff --git a/kasa/protocol.py b/kasa/protocol.py index 1107fa1d..140e9c41 100755 --- a/kasa/protocol.py +++ b/kasa/protocol.py @@ -91,7 +91,9 @@ class BaseTransport(ABC): self._port = config.port_override or self.default_port self._credentials = config.credentials self._credentials_hash = config.credentials_hash - self._timeout = config.timeout or self.DEFAULT_TIMEOUT + if not config.timeout: + config.timeout = self.DEFAULT_TIMEOUT + self._timeout = config.timeout @property @abstractmethod