Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: mark up FTP() constructor with param list #114359

Merged
merged 2 commits into from
Jan 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions Doc/library/ftplib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,43 @@ Reference
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.
.. 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 :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.
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved

:param str user:
The username to log in with.
If empty string, ``"anonymous"`` is used.
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved

: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
erlend-aasland marked this conversation as resolved.
Show resolved Hide resolved

: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.:

Expand Down
Loading