nginx, added timeout to requests

This commit is contained in:
Zsolt Ero
2024-01-08 19:16:32 +01:00
parent 44359c8ca9
commit a011f9c803
5 changed files with 29 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ def download_if_size_differs(url: str, local_file: Path) -> bool:
def get_remote_file_size(url: str) -> int | None:
r = requests.head(url)
r = requests.head(url, timeout=30)
size = r.headers.get('Content-Length')
return int(size) if size else None