module
lbsWebThis module contains web utility methods.
Functions
- def download(url: str, target_dir: str, logger: logging.Logger, expected_content_type: str = 'text/plain', file_title: typing.Optional[str] = None)
- Download a file to a local directory.
Function documentation
def lbaf. Utils. lbsWeb. download(url: str,
target_dir: str,
logger: logging.Logger,
expected_content_type: str = 'text/plain',
file_title: typing.Optional[str] = None)
Download a file to a local directory.
:param url: The url :param target_dir: The directory where to place the downloaded file. :param logger: A logger instance for logs :param expected_content_type: Specify the expected content type of the file :param file_title: Used for logs. Defaults to the downloaded file name.
:raises ConnectionError: on connection error :raises ConnectionError: on HTTP response error :raises ConnectionError: on invalid content type and if file has not already been downloaded