🛠️ Implemented timeout for `requests calls.

This commit is contained in:
Robert Honz
2024-01-12 08:38:41 +01:00
parent 1494490476
commit 69cf0b4707
4 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ from rich.progress import Progress
from tidalapi import Album, Mix, Playlist, Session, Track, UserPlaylist, Video
from tidal_dl_ng.config import Settings
from tidal_dl_ng.constants import MediaType
from tidal_dl_ng.constants import REQUESTS_TIMEOUT_SEC, MediaType
from tidal_dl_ng.helper.decryption import decrypt_file, decrypt_security_token
from tidal_dl_ng.helper.exceptions import MediaUnknown
from tidal_dl_ng.helper.path import check_file_exists, format_path_media, path_validate
@@ -134,7 +134,7 @@ class Download:
try:
# Streaming, so we can iterate over the response.
r = requests.get(stream_url, stream=True)
r = requests.get(stream_url, stream=True, timeout=REQUESTS_TIMEOUT_SEC)
r.raise_for_status()
total_size_in_bytes = int(r.headers.get("content-length", 0))
block_size = 4096