@@ -55,17 +55,43 @@ Reference
5555FTP 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
@@ -102,12 +128,15 @@ FTP objects
102128
103129 .. method :: FTP.set_debuglevel(level)
104130
105- Set the instance's debugging level. This controls the amount of debugging
106- output printed. The default, ``0 ``, produces no debugging output. A value of
107- ``1 `` produces a moderate amount of debugging output, generally a single line
108- per request. A value of ``2 `` or higher produces the maximum amount of
109- debugging output, logging each line sent and received on the control connection.
131+ Set the instance's debugging level as an :class: `int `.
132+ This controls the amount of debugging output printed.
133+ The debug levels are:
110134
135+ * ``0 `` (default): No debug output.
136+ * ``1 ``: Produce a moderate amount of debug output,
137+ generally a single line per request.
138+ * ``2 `` or higher: Produce the maximum amount of debugging output,
139+ logging each line sent and received on the control connection.
111140
112141 .. method :: FTP.connect(host='', port=0, timeout=None, source_address=None)
113142
@@ -192,7 +221,7 @@ FTP objects
192221 ``NLST `` retrieves a list of file names.
193222 The *callback * function is called for each line with a string argument
194223 containing the line with the trailing CRLF stripped. The default *callback *
195- prints the line to `` sys.stdout ` `.
224+ prints the line to :data: ` sys.stdout `.
196225
197226
198227 .. method :: FTP.set_pasv(val)
@@ -282,7 +311,7 @@ FTP objects
282311 current server directory). Multiple arguments can be used to pass non-standard
283312 options to the ``LIST `` command. If the last argument is a function, it is used
284313 as a *callback * function as for :meth: `retrlines `; the default prints to
285- `` sys.stdout ` `. This method returns ``None ``.
314+ :data: ` sys.stdout `. This method returns ``None ``.
286315
287316 .. note :: If your server supports the command, :meth:`mlsd` offers a better API.
288317
0 commit comments