@@ -58,15 +58,40 @@ FTP objects
58
58
.. class :: FTP(host='', user='', passwd='', acct='', timeout=None, \
59
59
source_address=None, *, encoding='utf-8')
60
60
61
- Return a new instance of the :class: `FTP ` class. When *host * is given, the
62
- method call ``connect(host) `` is made. When *user * is given, additionally
63
- the method call ``login(user, passwd, acct) `` is made (where *passwd * and
64
- *acct * default to the empty string when not given). The optional *timeout *
65
- parameter specifies a timeout in seconds for blocking operations like the
66
- connection attempt (if is not specified, the global default timeout setting
67
- will be used). *source_address * is a 2-tuple ``(host, port) `` for the socket
68
- to bind to as its source address before connecting. The *encoding * parameter
69
- specifies the encoding for directories and filenames.
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.
70
95
71
96
The :class: `FTP ` class supports the :keyword: `with ` statement, e.g.:
72
97
0 commit comments