Kaydet (Commit) 979d79cd authored tarafından Georg Brandl's avatar Georg Brandl

Fix-up ftplib documentation:

move exception descriptions to toplevel, not inside a class
remove attribution in "versionadded"
spell and grammar check docstring of FTP_TLS
üst 3fd2db90
...@@ -33,8 +33,8 @@ Here's a sample session using the :mod:`ftplib` module:: ...@@ -33,8 +33,8 @@ Here's a sample session using the :mod:`ftplib` module::
'226 Transfer complete.' '226 Transfer complete.'
>>> ftp.quit() >>> ftp.quit()
The module defines the following items:
The module defines the following items:
.. class:: FTP([host[, user[, passwd[, acct[, timeout]]]]]) .. class:: FTP([host[, user[, passwd[, acct[, timeout]]]]])
...@@ -49,24 +49,24 @@ The module defines the following items: ...@@ -49,24 +49,24 @@ The module defines the following items:
.. versionchanged:: 2.6 .. versionchanged:: 2.6
*timeout* was added. *timeout* was added.
.. class:: FTP_TLS([host[, user[, passwd[, acct[, keyfile[, certfile[, timeout]]]]]]]) .. class:: FTP_TLS([host[, user[, passwd[, acct[, keyfile[, certfile[, timeout]]]]]]])
A :class:`FTP` subclass which adds TLS support to FTP as described in A :class:`FTP` subclass which adds TLS support to FTP as described in
:rfc:`4217`. :rfc:`4217`.
Connect as usual to port 21 implicitly securing the FTP control connection Connect as usual to port 21 implicitly securing the FTP control connection
before authenticating. Securing the data connection requires user to before authenticating. Securing the data connection requires the user to
explicitly ask for it by calling :exc:`prot_p()` method. explicitly ask for it by calling the :meth:`prot_p` method.
*keyfile* and *certfile* are optional - they can contain a PEM formatted *keyfile* and *certfile* are optional -- they can contain a PEM formatted
private key and certificate chain file for the SSL connection. private key and certificate chain file name for the SSL connection.
.. versionadded:: 2.7 Contributed by Giampaolo Rodola' .. versionadded:: 2.7
Here's a sample session using the :class:`FTP_TLS` class:
Here's a sample session using :class:`FTP_TLS` class:
>>> from ftplib import FTP_TLS >>> from ftplib import FTP_TLS
>>> ftps = FTP_TLS('ftp.python.org') >>> ftps = FTP_TLS('ftp.python.org')
>>> ftps.login() # login anonimously previously securing control channel >>> ftps.login() # login anonymously before securing control channel
>>> ftps.prot_p() # switch to secure data connection >>> ftps.prot_p() # switch to secure data connection
>>> ftps.retrlines('LIST') # list directory content securely >>> ftps.retrlines('LIST') # list directory content securely
total 9 total 9
...@@ -84,43 +84,42 @@ The module defines the following items: ...@@ -84,43 +84,42 @@ The module defines the following items:
>>> >>>
.. exception:: error_reply
.. attribute:: all_errors
The set of all exceptions (as a tuple) that methods of :class:`FTP`
instances may raise as a result of problems with the FTP connection (as
opposed to programming errors made by the caller). This set includes the
four exceptions listed below as well as :exc:`socket.error` and
:exc:`IOError`.
.. exception:: error_reply
Exception raised when an unexpected reply is received from the server. Exception raised when an unexpected reply is received from the server.
.. exception:: error_temp .. exception:: error_temp
Exception raised when an error code in the range 400--499 is received. Exception raised when an error code in the range 400--499 is received.
.. exception:: error_perm .. exception:: error_perm
Exception raised when an error code in the range 500--599 is received. Exception raised when an error code in the range 500--599 is received.
.. exception:: error_proto .. exception:: error_proto
Exception raised when a reply is received from the server that does not Exception raised when a reply is received from the server that does not
begin with a digit in the range 1--5. begin with a digit in the range 1--5.
.. data:: all_errors
The set of all exceptions (as a tuple) that methods of :class:`FTP`
instances may raise as a result of problems with the FTP connection (as
opposed to programming errors made by the caller). This set includes the
four exceptions listed below as well as :exc:`socket.error` and
:exc:`IOError`.
.. seealso:: .. seealso::
Module :mod:`netrc` Module :mod:`netrc`
Parser for the :file:`.netrc` file format. The file :file:`.netrc` is typically Parser for the :file:`.netrc` file format. The file :file:`.netrc` is
used by FTP clients to load user authentication information before prompting the typically used by FTP clients to load user authentication information
user. before prompting the user.
.. index:: single: ftpmirror.py .. index:: single: ftpmirror.py
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment