This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients MicaelJarniac, andrei.avk, docs@python, eric.smith
Date 2021-06-17.12:22:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623932526.44.0.997093061472.issue44365@roundup.psfhosted.org>
In-reply-to
Content
I was thinking about something like:

@dataclass
class FtpHelper(ftplib.FTP):
    my_host: str
    my_user: str
    lookup_password: InitVar[Callable]

    def __post_init__(self, lookup_password):
        super().__init__(host=self.my_host, user=self.my_user, passwd=lookup_password())

def get_password():
    return "a password"

ftp = FtpHelper(hostname, username, get_password)
History
Date User Action Args
2021-06-17 12:22:06eric.smithsetrecipients: + eric.smith, docs@python, andrei.avk, MicaelJarniac
2021-06-17 12:22:06eric.smithsetmessageid: <1623932526.44.0.997093061472.issue44365@roundup.psfhosted.org>
2021-06-17 12:22:06eric.smithlinkissue44365 messages
2021-06-17 12:22:06eric.smithcreate