summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-01-21 11:33:37 (GMT)
committerGitHub <noreply@github.com>2024-01-21 11:33:37 (GMT)
commitd2551cfc6b16fbd06b04921b715aaca02035bdf5 (patch)
tree51541a695e2a7c4b4b6972ae75b9c6a54a6572ac
parentbd8bd4f404fedae53b062879e19f540567ea94d4 (diff)
downloadcpython-d2551cfc6b16fbd06b04921b715aaca02035bdf5.zip
cpython-d2551cfc6b16fbd06b04921b715aaca02035bdf5.tar.gz
cpython-d2551cfc6b16fbd06b04921b715aaca02035bdf5.tar.bz2
[3.11] Docs: mark up FTP() constructor with param list (GH-114359) (#114383)
(cherry picked from commit 96c15b1c8d03db5b7b5b719214d9d156b317ba9d) Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
-rw-r--r--Doc/library/ftplib.rst43
1 files changed, 34 insertions, 9 deletions
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst
index e4b696c..07100d4 100644
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -58,15 +58,40 @@ FTP objects
.. class:: FTP(host='', user='', passwd='', acct='', timeout=None, \
source_address=None, *, encoding='utf-8')
- Return a new instance of the :class:`FTP` class. When *host* is given, the
- method call ``connect(host)`` is made. When *user* is given, additionally
- the method call ``login(user, passwd, acct)`` is made (where *passwd* and
- *acct* default to the empty string when not given). The optional *timeout*
- parameter specifies a timeout in seconds for blocking operations like the
- connection attempt (if is not specified, the global default timeout setting
- will be used). *source_address* is a 2-tuple ``(host, port)`` for the socket
- to bind to as its source address before connecting. The *encoding* parameter
- specifies the encoding for directories and filenames.
+ Return a new instance of the :class:`FTP` class.
+ When *host* is given, the method call :meth:`connect(host) <connect>`
+ is made by the constructor.
+ When *user* is given, additionally the method call
+ :meth:`login(user, passwd, acct) <connect>` is made.
+
+ :param str host:
+ The hostname to connect to.
+
+ :param str user:
+ The username to log in with.
+ If empty string, ``"anonymous"`` is used.
+
+ :param str passwd:
+ The password to use when logging in.
+ If not given, and if *passwd* is the empty string or ``"-"``,
+ a password will be automatically generated.
+
+ :param str acct:
+ Account information; see the ACCT FTP command.
+
+ :param timeout:
+ A timeout in seconds for blocking operations like :meth:`connect`.
+ If not specified, the global default timeout setting will be used.
+ :type timeout: int | None
+
+ :param source_address:
+ *source_address* is a 2-tuple ``(host, port)`` for the socket
+ to bind to as its source address before connecting.
+ :type source_address: tuple | None
+
+ :param str encoding:
+ The *encoding* parameter specifies the encoding
+ for directories and filenames.
The :class:`FTP` class supports the :keyword:`with` statement, e.g.: