pooch.SFTPDownloader

pooch.SFTPDownloader#

class pooch.SFTPDownloader(port=22, username='anonymous', password='', account='', timeout=None, progressbar=False)[source]#

Download manager for fetching files over SFTP.

When called, downloads the given file URL into the specified local file. Requires paramiko to be installed.

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

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

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

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

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

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

Methods Summary

SFTPDownloader.__call__(url, output_file, pooch)

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


SFTPDownloader.__call__(url, output_file, pooch)[source]#

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

The output file must be given as a string (file name/path) and not an open file object! Otherwise, paramiko cannot save to that file.

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

  • output_file (str) – Path (and file name) to which the file will be downloaded. Cannot be a file object.

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