sinatools.DataDownload.downloader¶
-
sinatools.DataDownload.downloader.
download_file
(url, dest_path)¶ Downloads a file from the specified URL and saves it to the specified destination path.
- Parameters
- Returns
The absolute path of the downloaded file.
- Return type
- Raises
requests.exceptions.HTTPError – If there was an HTTP error during the request.
Note
This method checks if the compressed downloaded file type and extracts it.
Example:
download_file(url='https://example.com/data.zip', dest_path='data/')
-
sinatools.DataDownload.downloader.
extract_tar
(file_path, dest_path)¶ Extracts the contents of a tar.gz file to the specified destination path.
-
sinatools.DataDownload.downloader.
extract_zip
(file_path, extracted_folder_name)¶ Extracts the contents of a ZIP file to the specified folder.
-
sinatools.DataDownload.downloader.
get_appdatadir
()¶ This method checks if the directory exists and creates if it doesn’t. And returns the path to the directory where the application data is stored.
Example:
from sinatools.DataDownload import downloader path = downloader.get_appdatadir() Windows: 'C:/Users/<Username>/AppData/Roaming/sinatools' MacOS: '/Users/<Username>/Library/Application Support/sinatools' Linux: '/home/<Username>/.sinatools' Google Colab: '/content/sinatools'