gchar.utils.download

download_file

gchar.utils.download.download_file(url, filename, expected_size: int = None, desc=None, session=None, silent: bool = False, **kwargs)[source]

Downloads a file from the given URL and saves it to the specified filename.

Parameters:
  • url (str) – The URL of the file to download.

  • filename (str) – The filename to save the downloaded file to.

  • expected_size (int) – The expected size of the file in bytes. (default: None)

  • desc (str) – The description of the download progress. If not provided, the filename is used. (default: None)

  • session (requests.Session) – An existing requests Session object to use for the download. If not provided, a new Session object is created. (default: None)

  • silent (bool) – Whether to silence the progress bar. If True, no progress bar is displayed. (default: False)

  • kwargs (dict) – Additional keyword arguments to pass to the srequest function.

Returns:

The filename of the downloaded file.

Return type:

str