Download helper module

class rebasehelper.helpers.download_helper.DownloadHelper[source]

Class for downloading files and performing HTTP requests.

static download_file(url, destination_path, blocksize=8192)[source]

Downloads a file from HTTP, HTTPS or FTP URL.

Parameters:
  • url (str) – URL to be downloaded.

  • destination_path (str) – Path to where the downloaded file will be stored.

  • blocksize (int) – Block size in bytes.

static progress(download_total, downloaded, start_time, show_size=True)[source]

Prints current progress and estimated remaining time of a download to the standard output.

Parameters:
  • download_total (int) – Total download size in bytes.

  • downloaded (int) – Size of the already downloaded portion of a file in bytes.

  • start_time (float) – Time when the download started in seconds since epoch.

  • show_size (bool) – Whether to show the number of downloaded bytes.

static request(url, **kwargs)[source]

Performs an HTTP request or an FTP RETR command.

Parameters:
  • url (str) – HTTP, HTTPS or FTP URL.

  • **kwargs – Keyword arguments to be passed to requests.session.get().

Returns:

Response object.

Return type:

requests.Response