Do not pass None as timeout to http requests (#1203)

This commit is contained in:
Steven B. 2024-10-29 11:52:53 +00:00 committed by GitHub
parent 7483411ca2
commit b82743a5de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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.

View File

@ -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