wolfhece.pydownloader

Author: HECE - University of Liege, Pierre Archambeau Date: 2025

Copyright (c) 2025 University of Liege. All rights reserved.

This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.

Module Contents

class wolfhece.pydownloader.DownloadType(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.pydownloader.DownloadType

Enum to define the type of download.

HTTP = 'http'[source]
HTTPS = 'https'[source]
FTP = 'ftp'[source]
class wolfhece.pydownloader.DownloadFiles(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.pydownloader.DownloadFiles

Enum to define the files to download.

WOLFARRAYS = ('bin', 'bin.txt')[source]
TIFARRAYS = ('tif',)[source]
TIFFARRAYS = ('tiff',)[source]
SHPFILES = ('shp', 'dbf', 'shx', 'prj', 'cpg', 'sbn', 'sbx')[source]
GPKGFILES = ('gpkg',)[source]
VECFILES = ('vec', 'vec.extra')[source]
VECZFILES = ('vecz', 'vecz.extra')[source]
PROJECTFILES = ('proj',)[source]
class wolfhece.pydownloader.DonwloadDirectories(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.pydownloader.DonwloadDirectories

Enum to define the directories for downloads.

GDBFILES = ('gdb',)[source]
wolfhece.pydownloader.GITLAB_EXAMPLE = 'https://gitlab.uliege.be/HECE/wolf_examples/-/raw/main'[source]
wolfhece.pydownloader.DATADIR[source]
wolfhece.pydownloader.clean_url(url: str) str[source]

Clean the URL by removing any query parameters or fragments.

Parameters:

url (str) – The URL to clean.

Returns:

The cleaned URL.

Return type:

str

wolfhece.pydownloader.download_file(url: str, destination: str | pathlib.Path = None, download_type: DownloadType = DownloadType.HTTP, load_from_cache: bool = True) None[source]

Download a file from the specified URL to the destination path.

Parameters:
  • url (str) – The URL of the file to download.

  • destination (Union[str, Path]) – The path where the file will be saved.

  • download_type (DownloadType) – The type of download (HTTP, HTTPS, FTP).

Returns:

None

Raises:

requests.HTTPError – If the HTTP request fails.

wolfhece.pydownloader.toys_dataset(dir: str, file: str, load_from_cache: bool = True)[source]

Download toy files from the WOLFHECE dataset.

Parameters:
  • dir (str) – The directory where the file will be saved.

  • file (str) – The name of the file to download.

Returns:

The path to the downloaded file.