GitHubFileDownloader.download

GitHubFileDownloader.download(api_url=None)[source]

Downloads files from the specified GitHub api_url.

Parameters:

api_url (str | None) – GitHub API URL for downloading files; defaults to None.

Returns:

Total number of files downloaded under the given directory.

Return type:

int

See also

>>> from pyhelpers.ops import GitHubFileDownloader
>>> from pyhelpers.dirs import delete_dir
>>> import tempfile
>>> test_output_dir = tempfile.mkdtemp()
>>> test_url = "https://github.com/mikeqfu/pyhelpers/blob/master/tests/data"
>>> downloader = GitHubFileDownloader(test_url, output_dir=test_output_dir)
>>> downloader.download()
Downloaded to: "<temp_dir>/tests/data/csr_mat.npz"
Downloaded to: "<temp_dir>/tests/data/dat.csv"
Downloaded to: "<temp_dir>/tests/data/dat.feather"
Downloaded to: "<temp_dir>/tests/data/dat.joblib"
Downloaded to: "<temp_dir>/tests/data/dat.json"
Downloaded to: "<temp_dir>/tests/data/dat.ods"
Downloaded to: "<temp_dir>/tests/data/dat.pickle"
Downloaded to: "<temp_dir>/tests/data/dat.pickle.bz2"
Downloaded to: "<temp_dir>/tests/data/dat.pickle.gz"
Downloaded to: "<temp_dir>/tests/data/dat.pickle.xz"
Downloaded to: "<temp_dir>/tests/data/dat.txt"
Downloaded to: "<temp_dir>/tests/data/dat.xlsx"
Downloaded to: "<temp_dir>/tests/data/zipped.7z"
Downloaded to: "<temp_dir>/tests/data/zipped.txt"
Downloaded to: "<temp_dir>/tests/data/zipped.zip"
>>> delete_dir(test_output_dir, confirmation_required=False, verbose=True)
Deleting "<temp_dir>/" ... Done.