Add timeouts to requests calls (#76851)

This commit is contained in:
Marc Mueller 2022-08-19 08:58:18 +02:00 committed by GitHub
parent 4eb4146e29
commit 1faabb8f40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 7 deletions

View file

@ -87,7 +87,7 @@ def _create_processor_from_config(hass, camera_entity, config):
def _get_default_classifier(dest_path):
"""Download the default OpenCV classifier."""
_LOGGER.info("Downloading default classifier")
req = requests.get(CASCADE_URL, stream=True)
req = requests.get(CASCADE_URL, stream=True, timeout=10)
with open(dest_path, "wb") as fil:
for chunk in req.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks