peakweather.io¶
- class DownloadProgressBar(*_, **__)¶
Bases:
tqdmProvides a progress bar for downloading files using urllib.
- update_to(b=1, bsize=1, tsize=None)¶
Updates the progress bar.
- download_url(url: str, folder: str, filename: str | None = None) str¶
Downloads the content of a URL to a specific folder.
- Parameters:
url (string) – The url.
folder (string) – The folder.
filename (string, optional) – The filename. If
None, it is inferred from the url.
- Returns:
The path to the downloaded file.
- Return type:
string
- Raises:
FileExistsError – If the file already exists in the specified folder.
- extract_tar(path: str, folder: str)¶
Extracts a tar (or tar.gz) archive to a specific folder.
- Parameters:
path (string) – The path to the tar(gz) archive.
folder (string) – The destination folder.
- extract_zip(path: str, folder: str)¶
Extracts a zip archive to a specific folder.
- Parameters:
path (string) – The path to the zip archive.
folder (string) – The folder.
- import_xarray() ModuleType¶
Attempts to import the ‘xarray’ module and return it.
- Returns:
The imported ‘xarray’ module.
- Return type:
- Raises:
ModuleNotFoundError – If ‘xarray’ is not installed.