From 30473bafef0a61356649577212b1c7b045181db9 Mon Sep 17 00:00:00 2001 From: Julien M Date: Tue, 28 Nov 2023 10:30:29 +0100 Subject: [PATCH] sync: add http handler base --- .../profiles/remote_http_handler.py | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 qgis_deployment_toolbelt/profiles/remote_http_handler.py diff --git a/qgis_deployment_toolbelt/profiles/remote_http_handler.py b/qgis_deployment_toolbelt/profiles/remote_http_handler.py new file mode 100644 index 00000000..0ab128fa --- /dev/null +++ b/qgis_deployment_toolbelt/profiles/remote_http_handler.py @@ -0,0 +1,72 @@ +#! python3 # noqa: E265 + +""" + Handle remote HTTP repository. + + Author: Julien Moura (https://github.com/guts). +""" + + +# ############################################################################# +# ########## Libraries ############# +# ################################## + +# Standard library +import logging +from pathlib import Path + +from qgis_deployment_toolbelt.profiles.profiles_handler_base import ( + RemoteProfilesHandlerBase, +) + +# project + +# ############################################################################# +# ########## Globals ############### +# ################################## + +# logs +logger = logging.getLogger(__name__) + + +# ############################################################################# +# ########## Classes ############### +# ################################## +class HttpHandler(RemoteProfilesHandlerBase): + """Handle remote HTTP repositories without git protocol. + + It's designed to handle thoses cases: + + - the distant repository (source) is on a webserver accessible through HTTP protocol + - the local repository (destination) is on a local network or drive + """ + + def __init__( + self, + source_repository_path_or_uri: str, + source_repository_type: str = "http", + ) -> None: + """Constructor. + + Args: + source_repository_path_or_uri (str | Path): path to the source repository + """ + super().__init__(source_repository_type=source_repository_type) + + def download(self, destination_local_path: Path): + """Generic wrapper around the specific logic of this handler. + + Args: + destination_local_path (Path): path to the local folder where to download + + """ + logger.info("Start downloading from") + + +# ############################################################################# +# ##### Stand alone program ######## +# ################################## + +if __name__ == "__main__": + """Standalone execution.""" + pass