voxcity.downloader.utils ======================== .. py:module:: voxcity.downloader.utils Functions --------- .. autoapisummary:: voxcity.downloader.utils.download_file Module Contents --------------- .. py:function:: download_file(url, filename, *, timeout=60, max_retries=3, initial_delay=2.0, backoff_factor=2.0, chunk_size=8192) Download a file from a URL and save it locally with retry and streaming. Uses streaming to avoid loading large files entirely into memory and retries on transient network failures with exponential backoff. :param url: URL of the file to download. :type url: str :param filename: Local path where the downloaded file will be saved. :type filename: str :param timeout: Request timeout in seconds (default 60). :type timeout: int :param max_retries: Number of retry attempts on failure (default 3). :type max_retries: int :param initial_delay: Seconds to wait before the first retry (default 2.0). :type initial_delay: float :param backoff_factor: Multiplier for delay between retries (default 2.0). :type backoff_factor: float :param chunk_size: Bytes per chunk when streaming (default 8192). :type chunk_size: int :raises requests.HTTPError: If download fails after all retries. .. rubric:: Example >>> download_file('https://example.com/file.pdf', 'local_file.pdf')