FtpFinder

class gdt.core.heasarc.FtpFinder(*args, **kwargs)[source]

Bases: BaseFinder

Class providing backwards compatibility for code written prior to v2.0.5 where the FtpFinder handled most interactions with HEASARC

Parameters:
  • args – The set of parameters needed to define the data path

  • **kwargs – Options passed to Ftp class

Attributes Summary

cwd

files

The list of files in the current directory

num_files

Number of files in the current directory

Methods Summary

cd(*args)

Change directory

filter(filetype, extension)

Filters the directory for the requested filetype and extension

get(download_dir, files[, verbose])

Downloads a list of files from the current FTP directory.

ls(*args[, fullpath])

List the contents of a directory

Attributes Documentation

cwd
files

The list of files in the current directory

Type:

(list of str)

num_files

Number of files in the current directory

Type:

(int)

Methods Documentation

cd(*args)

Change directory

Parameters:

args (tuple) – The arguments needed to construct the remote path

filter(filetype, extension)

Filters the directory for the requested filetype and extension

Parameters:
  • filetype (str) – The type of file, e.g. ‘cspec’

  • extension (str) – The file extension, e.g. ‘.pha’

Returns:

(list)

get(download_dir: Union[str, Path], files: List[str], verbose: bool = True) List[Path]

Downloads a list of files from the current FTP directory. This function also returns a list of the downloaded file paths.

Parameters:
  • download_dir (str, Path) – The download directory location

  • files (list of str) – The list of files to download

  • verbose (bool, optional) – If True, will output the download status. Default is True.

Returns:

(list)

ls(*args, fullpath: bool = False)

List the contents of a directory

Parameters:
  • args (tuple) – The arguments needed to construct the remote path

  • fullpath (bool, optional) – If True, will list all files in the current with their full path.