The netrc module

This module parses .netrc configuration files. Such
files are used to store FTP user names and passwords in a user’s
home directory (don’t forget to configure things so that the file
can only be read by the user: “chmod 0600
~/.netrc”, in other words).