[New-bugs-announce] [issue44788] Possibility to specify port in __init__ of ftplib.FTP
Marty
report at bugs.python.org
Fri Jul 30 19:34:00 EDT 2021
New submission from Marty <vpjtqwv0101 at gmail.com>:
I think all that's needed is to add new parameter port in __init__ and then add it to self.connect() as argument:
def __init__(self, host='', port=0, user='', passwd='', acct='',
timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None, *,
encoding='utf-8'):
self.encoding = encoding
self.source_address = source_address
self.timeout = timeout
if host:
self.connect(host, port)
if user:
self.login(user, passwd, acct)
Currently if I need to specify port, I have to do it like this:
with FTP() as ftp:
ftp.connect(host, port)
ftp.login(user, password)
# my actions
I the port parameter would be added, I could use it like this:
with FTP(host, port, user, password) as ftp:
# my actions
Thank you.
----------
components: Library (Lib)
messages: 398611
nosy: vpjtqwv0101
priority: normal
severity: normal
status: open
title: Possibility to specify port in __init__ of ftplib.FTP
type: enhancement
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44788>
_______________________________________
More information about the New-bugs-announce
mailing list