Skip to content

msaJustPyUI Module

.jpcore.download


Created on 2022-09-02 modified version, original from JustPy @author: wf (modification swelcker)

Classes

Download

Utility functions for downloading data

Functions

download_backup_file staticmethod
download_backup_file(
    url: str,
    file_name: str,
    target_directory: str,
    force: bool = False,
) -> str

Downloads from the given url the zip-file and extracts the file corresponding to the given file_name.

PARAMETER DESCRIPTION
url

url linking to a downloadable gzip file

TYPE: str

file_name

Name of the file that should be extracted from gzip file

TYPE: str

target_directory

download the file this directory

TYPE: str

force

True if the download should be forced

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
extract_to

Name of the extracted file with path to the backup directory

TYPE: str

download_file staticmethod
download_file(
    url: str,
    file_name: str,
    target_directory: str,
    force: bool = False,
)
get_cache_path staticmethod
get_cache_path()
get_file_content staticmethod
get_file_content(path: str)
get_url_content staticmethod
get_url_content(url: str)
needs_download staticmethod
needs_download(file_path: str, force: bool = False) -> bool

Check if a download of the given file_path is necessary that is the file does not exist has a size of zero or the download should be forced

PARAMETER DESCRIPTION
file_path

the path of the file to be checked

TYPE: str

force

True if the result should be forced to True

TYPE: bool DEFAULT: False

Return

result: True if a download for this file needed


Last update: September 28, 2022
Created: September 28, 2022