iwfm.util.ftp_fetch¶
- iwfm.util.ftp_fetch(server, dir, filename='download.txt', verbose=False)[source]¶
Download a file from a server and save to the specified directory and file name.
This function uses anonymous FTP login to access the server. Anonymous FTP allows public access without requiring a username or password. The connection is made using the ‘anonymous’ username with an empty password (or optionally an email address as password).
- Parameters:
- Returns:
File is saved to the current working directory
- Return type:
None
- Raises:
ConnectionError – If unable to connect to FTP server
PermissionError – If anonymous login is denied
FileNotFoundError – If directory or file not found on server
IOError – If unable to write file locally
Notes
Anonymous FTP Login: - Uses username: ‘anonymous’ (implicit in ftplib.FTP.login()) - Uses password: ‘’ (empty) or email address - Requires server to allow anonymous access - Common for public data repositories and archives