pooch.FTPDownloader

class pooch.FTPDownloader(port=21, username='anonymous', password='', account='', timeout=None, progressbar=False, chunk_size=1024)[source]

Download manager for fetching files over FTP.

When called, downloads the given file URL into the specified local file. Uses the ftplib module to manage downloads.

Use with pooch.Pooch.fetch to customize the download of files (for example, to use authentication or print a progress bar).

Parameters
  • port (int) – Port used for the FTP connection.

  • username (str) – User name used to login to the server. Only needed if the server requires authentication (i.e., no anonymous FTP).

  • password (str) – Password used to login to the server. Only needed if the server requires authentication (i.e., no anonymous FTP). Use the empty string to indicate no password is required.

  • account (str) – Some servers also require an “account” name for authentication.

  • timeout (int) – Timeout in seconds for ftp socket operations, use None to mean no timeout.

  • progressbar (bool) – If True, will print a progress bar of the download to standard error (stderr). Requires tqdm to be installed.

  • chunk_size (int) – Files are streamed chunk_size bytes at a time instead of loading everything into memory at one. Usually doesn’t need to be changed.

Methods Summary

FTPDownloader.__call__(url, output_file, pooch)

Download the given URL over FTP to the given output file.


FTPDownloader.__call__(url, output_file, pooch)[source]

Download the given URL over FTP to the given output file.

Parameters
  • url (str) – The URL to the file you want to download.

  • output_file (str or file-like object) – Path (and file name) to which the file will be downloaded.

  • pooch (Pooch) – The instance of Pooch that is calling this method.