mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
[3.12] Docs: mark up FTP() constructor with param list (GH-114359) (#114382)
(cherry picked from commit 96c15b1c8d
)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
5dc4857661
commit
24fa45b59f
1 changed files with 36 additions and 10 deletions
|
@ -55,17 +55,43 @@ Reference
|
||||||
FTP objects
|
FTP objects
|
||||||
^^^^^^^^^^^
|
^^^^^^^^^^^
|
||||||
|
|
||||||
.. class:: FTP(host='', user='', passwd='', acct='', timeout=None, source_address=None, *, encoding='utf-8')
|
.. 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
|
Return a new instance of the :class:`FTP` class.
|
||||||
method call ``connect(host)`` is made. When *user* is given, additionally
|
When *host* is given, the method call :meth:`connect(host) <connect>`
|
||||||
the method call ``login(user, passwd, acct)`` is made (where *passwd* and
|
is made by the constructor.
|
||||||
*acct* default to the empty string when not given). The optional *timeout*
|
When *user* is given, additionally the method call
|
||||||
parameter specifies a timeout in seconds for blocking operations like the
|
:meth:`login(user, passwd, acct) <connect>` is made.
|
||||||
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
|
:param str host:
|
||||||
to bind to as its source address before connecting. The *encoding* parameter
|
The hostname to connect to.
|
||||||
specifies the encoding for directories and filenames.
|
|
||||||
|
: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.:
|
The :class:`FTP` class supports the :keyword:`with` statement, e.g.:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue