wfexs_backend.fetchers.internal.ftp_downloader#

Module Contents#

Classes#

Functions#

_maybe_send_opts_utf8_on_patched

If the requested encoding is UTF-8 and the server supports the UTF8 feature, send “OPTS UTF8 ON”.

API#

wfexs_backend.fetchers.internal.ftp_downloader._maybe_send_opts_utf8_on_patched(session: ftplib.FTP, encoding: str) None#

If the requested encoding is UTF-8 and the server supports the UTF8 feature, send “OPTS UTF8 ON”.

See https://datatracker.ietf.org/doc/html/rfc2640.html .

class wfexs_backend.fetchers.internal.ftp_downloader.FTPDownloader(HOST: str, PORT: int = DEFAULT_FTP_PORT, USER: str = DEFAULT_USER, PASSWORD: str = DEFAULT_PASS, max_retries: int = DEFAULT_MAX_RETRIES)#

Initialization

DEFAULT_USER: Final[str] = 'ftp'#
DEFAULT_PASS: Final[str] = 'guest@example.org'#
DEFAULT_FTP_PORT: Final[int] = 21#
DEFAULT_MAX_RETRIES: Final[int] = 5#
__enter__() wfexs_backend.fetchers.internal.ftp_downloader.FTPDownloader#
__exit__(exc_type, exc_val, exc_tb)#
_download_dir(ftp_host: ftputil.FTPHost, download_path: str, utdPath: pathlib.Path, exclude_ext: Sequence[str]) Sequence[pathlib.Path]#

This method mirrors a whole directory into a destination one dfdPath must be absolute

_download_file(ftp_host: ftputil.FTPHost, download_path: str, upload_file_path: pathlib.Path) pathlib.Path#

download_path must be absolute

download_dir(download_from_dir: str, upload_to_dir: str = '.', exclude_ext: Sequence[str] = []) Sequence[pathlib.Path]#
download_file(download_from_file: str, upload_to_file: str) pathlib.Path#
download(download_path: str, upload_path: str, exclude_ext: Sequence[str] = []) pathlib.Path | Sequence[pathlib.Path]#

This method returns a pathlib.Path when a file is fetched and a list of pathlib.Path when it is a directory