mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Do not pass None as timeout to http requests (#1203)
This commit is contained in:
parent
7483411ca2
commit
b82743a5de
@ -97,9 +97,6 @@ class SslAesTransport(BaseTransport):
|
|||||||
self._default_credentials: Credentials = get_default_credentials(
|
self._default_credentials: Credentials = get_default_credentials(
|
||||||
DEFAULT_CREDENTIALS["TAPOCAMERA"]
|
DEFAULT_CREDENTIALS["TAPOCAMERA"]
|
||||||
)
|
)
|
||||||
|
|
||||||
if not config.timeout:
|
|
||||||
config.timeout = self.DEFAULT_TIMEOUT
|
|
||||||
self._http_client: HttpClient = HttpClient(config)
|
self._http_client: HttpClient = HttpClient(config)
|
||||||
|
|
||||||
self._state = TransportState.HANDSHAKE_REQUIRED
|
self._state = TransportState.HANDSHAKE_REQUIRED
|
||||||
|
@ -89,6 +89,8 @@ class HttpClient:
|
|||||||
self._last_url = url
|
self._last_url = url
|
||||||
self.client.cookie_jar.clear()
|
self.client.cookie_jar.clear()
|
||||||
return_json = bool(json)
|
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)
|
client_timeout = aiohttp.ClientTimeout(total=self._config.timeout)
|
||||||
|
|
||||||
# If json is not a dict send as data.
|
# If json is not a dict send as data.
|
||||||
|
@ -91,7 +91,9 @@ class BaseTransport(ABC):
|
|||||||
self._port = config.port_override or self.default_port
|
self._port = config.port_override or self.default_port
|
||||||
self._credentials = config.credentials
|
self._credentials = config.credentials
|
||||||
self._credentials_hash = config.credentials_hash
|
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
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user