Skip to content

Commit 96c15b1

Browse files
Docs: mark up FTP() constructor with param list (#114359)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 5adff3f commit 96c15b1

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

Doc/library/ftplib.rst

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,43 @@ Reference
5555
FTP objects
5656
^^^^^^^^^^^
5757

58-
.. class:: FTP(host='', user='', passwd='', acct='', timeout=None, source_address=None, *, encoding='utf-8')
59-
60-
Return a new instance of the :class:`FTP` class. When *host* is given, the
61-
method call ``connect(host)`` is made. When *user* is given, additionally
62-
the method call ``login(user, passwd, acct)`` is made (where *passwd* and
63-
*acct* default to the empty string when not given). The optional *timeout*
64-
parameter specifies a timeout in seconds for blocking operations like the
65-
connection attempt (if is not specified, the global default timeout setting
66-
will be used). *source_address* is a 2-tuple ``(host, port)`` for the socket
67-
to bind to as its source address before connecting. The *encoding* parameter
68-
specifies the encoding for directories and filenames.
58+
.. class:: FTP(host='', user='', passwd='', acct='', timeout=None, \
59+
source_address=None, *, encoding='utf-8')
60+
61+
Return a new instance of the :class:`FTP` class.
62+
When *host* is given, the method call :meth:`connect(host) <connect>`
63+
is made by the constructor.
64+
When *user* is given, additionally the method call
65+
:meth:`login(user, passwd, acct) <connect>` is made.
66+
67+
:param str host:
68+
The hostname to connect to.
69+
70+
:param str user:
71+
The username to log in with.
72+
If empty string, ``"anonymous"`` is used.
73+
74+
:param str passwd:
75+
The password to use when logging in.
76+
If not given, and if *passwd* is the empty string or ``"-"``,
77+
a password will be automatically generated.
78+
79+
:param str acct:
80+
Account information; see the ACCT FTP command.
81+
82+
:param timeout:
83+
A timeout in seconds for blocking operations like :meth:`connect`.
84+
If not specified, the global default timeout setting will be used.
85+
:type timeout: int | None
86+
87+
:param source_address:
88+
*source_address* is a 2-tuple ``(host, port)`` for the socket
89+
to bind to as its source address before connecting.
90+
:type source_address: tuple | None
91+
92+
:param str encoding:
93+
The *encoding* parameter specifies the encoding
94+
for directories and filenames.
6995

7096
The :class:`FTP` class supports the :keyword:`with` statement, e.g.:
7197

0 commit comments

Comments
 (0)