2007-08-15 11:28:22 -03:00
|
|
|
:mod:`ftplib` --- FTP protocol client
|
|
|
|
=====================================
|
|
|
|
|
|
|
|
.. module:: ftplib
|
|
|
|
:synopsis: FTP protocol client (requires sockets).
|
|
|
|
|
|
|
|
|
|
|
|
.. index::
|
|
|
|
pair: FTP; protocol
|
|
|
|
single: FTP; ftplib (standard module)
|
|
|
|
|
2011-02-21 15:58:37 -04:00
|
|
|
**Source code:** :source:`Lib/ftplib.py`
|
2011-01-27 16:38:46 -04:00
|
|
|
|
|
|
|
--------------
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
This module defines the class :class:`FTP` and a few related items. The
|
|
|
|
:class:`FTP` class implements the client side of the FTP protocol. You can use
|
|
|
|
this to write Python programs that perform a variety of automated FTP jobs, such
|
2008-06-23 01:41:59 -03:00
|
|
|
as mirroring other ftp servers. It is also used by the module
|
|
|
|
:mod:`urllib.request` to handle URLs that use FTP. For more information on FTP
|
|
|
|
(File Transfer Protocol), see Internet :rfc:`959`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Here's a sample session using the :mod:`ftplib` module::
|
|
|
|
|
|
|
|
>>> from ftplib import FTP
|
|
|
|
>>> ftp = FTP('ftp.cwi.nl') # connect to host, default port
|
|
|
|
>>> ftp.login() # user anonymous, passwd anonymous@
|
|
|
|
>>> ftp.retrlines('LIST') # list directory contents
|
|
|
|
total 24418
|
|
|
|
drwxrwsr-x 5 ftp-usr pdmaint 1536 Mar 20 09:48 .
|
|
|
|
dr-xr-srwt 105 ftp-usr pdmaint 1536 Mar 21 14:32 ..
|
|
|
|
-rw-r--r-- 1 ftp-usr pdmaint 5305 Mar 20 09:48 INDEX
|
|
|
|
.
|
|
|
|
.
|
|
|
|
.
|
|
|
|
>>> ftp.retrbinary('RETR README', open('README', 'wb').write)
|
|
|
|
'226 Transfer complete.'
|
|
|
|
>>> ftp.quit()
|
|
|
|
|
|
|
|
|
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
partially before. Also add a comment describing how this might have to work
with different versions of the interpreter.
........
r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line
Fixed typo
........
r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line
#7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line
Add note about usage of STRINGLIB_EMPTY.
........
r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line
Fix internal reference.
........
r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines
data descriptors do not override the class dictionary if __get__ is not defined
Adjust documentation and add a test to verify this behavior.
See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
discussion.
........
r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines
Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them. That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
........
r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line
Add two more test_strtod test values.
........
r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line
#7762: fix refcount annotation of PyUnicode_Tailmatch().
........
r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line
#7725: fix referencing issue.
........
r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line
mention from_float() in error message
........
r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line
#7802: fix invalid example (heh).
........
r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines
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
........
r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line
Minor modification to unittest documentation.
........
2010-02-02 22:35:45 -04:00
|
|
|
The module defines the following items:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-02-28 15:19:51 -04:00
|
|
|
.. class:: FTP(host='', user='', passwd='', acct='', timeout=None, source_address=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Return a new instance of the :class:`FTP` class. When *host* is given, the
|
Merged revisions 62998-63003,63005-63006,63009-63012,63014-63017,63019-63020,63022-63024,63026-63029,63031-63041,63043-63045,63047-63054,63056-63062 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62998 | andrew.kuchling | 2008-05-10 15:51:55 -0400 (Sat, 10 May 2008) | 7 lines
#1858 from Tarek Ziade:
Allow multiple repositories in .pypirc; see http://wiki.python.org/moin/EnhancedPyPI
for discussion.
The patch is slightly revised from Tarek's last patch: I've simplified
the PyPIRCCommand.finalize_options() method to not look at sys.argv.
Tests still pass.
........
r63000 | alexandre.vassalotti | 2008-05-10 15:59:16 -0400 (Sat, 10 May 2008) | 5 lines
Cleaned up io._BytesIO.write().
I am amazed that the old code, for inserting null-bytes, actually
worked. Who wrote that thing? Oh, it is me... doh.
........
r63002 | brett.cannon | 2008-05-10 16:52:01 -0400 (Sat, 10 May 2008) | 2 lines
Revert r62998 as it broke the build (seems distutils.config is missing).
........
r63014 | andrew.kuchling | 2008-05-10 18:12:38 -0400 (Sat, 10 May 2008) | 1 line
#1858: add distutils.config module
........
r63027 | brett.cannon | 2008-05-10 21:09:32 -0400 (Sat, 10 May 2008) | 2 lines
Flesh out the 3.0 deprecation to suggest using the ctypes module.
........
r63028 | skip.montanaro | 2008-05-10 22:59:30 -0400 (Sat, 10 May 2008) | 4 lines
Copied two versions of the example from the interactive session. Delete
one.
........
r63037 | georg.brandl | 2008-05-11 03:02:17 -0400 (Sun, 11 May 2008) | 2 lines
reload() takes the module itself.
........
r63038 | alexandre.vassalotti | 2008-05-11 03:06:04 -0400 (Sun, 11 May 2008) | 4 lines
Added test framework for handling module renames.
Factored the import guard in test_py3kwarn.TestStdlibRemovals into
a context manager, namely test_support.CleanImport.
........
r63039 | georg.brandl | 2008-05-11 03:06:05 -0400 (Sun, 11 May 2008) | 2 lines
#2742: ``''`` is not converted to NULL in getaddrinfo.
........
r63040 | alexandre.vassalotti | 2008-05-11 03:08:12 -0400 (Sun, 11 May 2008) | 2 lines
Fixed typo in a comment of test_support.CleanImport.
........
r63041 | alexandre.vassalotti | 2008-05-11 03:10:25 -0400 (Sun, 11 May 2008) | 2 lines
Removed a dead line of code.
........
r63043 | georg.brandl | 2008-05-11 04:47:53 -0400 (Sun, 11 May 2008) | 2 lines
#2812: document property.getter/setter/deleter.
........
r63049 | georg.brandl | 2008-05-11 05:06:30 -0400 (Sun, 11 May 2008) | 2 lines
#1153769: document PEP 237 changes to string formatting.
........
r63050 | georg.brandl | 2008-05-11 05:11:40 -0400 (Sun, 11 May 2008) | 2 lines
#2809: elaborate str.split docstring a bit.
........
r63051 | georg.brandl | 2008-05-11 06:13:59 -0400 (Sun, 11 May 2008) | 2 lines
Fix typo.
........
r63052 | georg.brandl | 2008-05-11 06:33:27 -0400 (Sun, 11 May 2008) | 2 lines
#2709: clarification.
........
r63053 | georg.brandl | 2008-05-11 06:42:28 -0400 (Sun, 11 May 2008) | 2 lines
#2659: add ``break_on_hyphens`` to TextWrapper.
........
r63057 | georg.brandl | 2008-05-11 06:59:39 -0400 (Sun, 11 May 2008) | 2 lines
#2741: clarification of value range for address_family.
........
r63058 | georg.brandl | 2008-05-11 07:09:35 -0400 (Sun, 11 May 2008) | 2 lines
#2452: timeout is used for all blocking operations.
........
r63059 | andrew.kuchling | 2008-05-11 09:33:56 -0400 (Sun, 11 May 2008) | 2 lines
#1792: Improve performance of marshal.dumps() on large objects by increasing
the size of the buffer more quickly.
........
r63060 | andrew.kuchling | 2008-05-11 10:00:00 -0400 (Sun, 11 May 2008) | 1 line
#1858: re-apply patch for this, adding the missing files
........
r63061 | benjamin.peterson | 2008-05-11 10:13:25 -0400 (Sun, 11 May 2008) | 2 lines
Add the "until" command to pdb
........
r63062 | georg.brandl | 2008-05-11 10:17:13 -0400 (Sun, 11 May 2008) | 2 lines
Add some sentence endings.
........
2008-05-15 21:03:33 -03:00
|
|
|
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
|
Merged revisions 63562,63570,63728,63734,63784,63788,63802,63817,63827,63839,63887,63975,63998 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63562 | martin.v.loewis | 2008-05-23 17:06:50 +0200 (Fri, 23 May 2008) | 2 lines
Patch #1722225: Support QNX 6.
........
r63570 | trent.nelson | 2008-05-23 22:33:14 +0200 (Fri, 23 May 2008) | 1 line
Introduce a user macro named $(externalsDir), which should point to the root directory of where all the external sources should live. Developers can change this value if their external sources live elsewhere. The default of '..\..' matches the current status quo.
........
r63728 | gregory.p.smith | 2008-05-26 23:16:34 +0200 (Mon, 26 May 2008) | 4 lines
Fix issue2589: there was a potential integer overflow leading to
memory corruption on esoteric platforms and incorrect behavior on
normal platforms.
........
r63734 | gregory.p.smith | 2008-05-27 00:07:28 +0200 (Tue, 27 May 2008) | 3 lines
Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is
passed in. (The assert won't prevent this in non-debug builds).
........
r63784 | raymond.hettinger | 2008-05-29 10:38:23 +0200 (Thu, 29 May 2008) | 1 line
Fix two typos.
........
r63788 | facundo.batista | 2008-05-29 18:39:26 +0200 (Thu, 29 May 2008) | 6 lines
Fixed the semantic of timeout for socket.create_connection and
all the upper level libraries that use it, including urllib2.
Added and fixed some tests, and changed docs correspondingly.
Thanks to John J Lee for the patch and the pusing, :)
........
r63802 | mark.dickinson | 2008-05-30 04:46:53 +0200 (Fri, 30 May 2008) | 2 lines
Fix typo in testSum
........
r63817 | raymond.hettinger | 2008-05-30 20:20:50 +0200 (Fri, 30 May 2008) | 8 lines
* Mark intermedidate computes values (hi, lo, yr) as volatile.
* Expand comments.
* Swap variable names in the sum_exact code so that x and y
are consistently chosen as the larger and smaller magnitude
values respectively.
........
r63827 | raymond.hettinger | 2008-05-31 05:24:31 +0200 (Sat, 31 May 2008) | 1 line
Implement heapq in terms of less-than (to match list.sort()).
........
r63839 | gerhard.haering | 2008-05-31 23:33:27 +0200 (Sat, 31 May 2008) | 2 lines
Fixed rowcount for SELECT statements. They're -1 now (again), for better DB-API 2.0 compliance.
........
r63887 | gregory.p.smith | 2008-06-02 06:05:52 +0200 (Mon, 02 Jun 2008) | 4 lines
Fix issue 2782: be less strict about the format string type in strftime.
Accept unicode and anything else ParseTuple "s#" can deal with. This
matches the time.strftime behavior.
........
r63975 | neal.norwitz | 2008-06-06 06:47:01 +0200 (Fri, 06 Jun 2008) | 3 lines
Aldo Cortesi confirmed this is still needed for OpenBSD 4.2 and 4.3.
(I didn't regen configure, since I don't have a working autoconf.)
........
r63998 | raymond.hettinger | 2008-06-06 23:47:51 +0200 (Fri, 06 Jun 2008) | 1 line
Issue 3501: Make heapq support both __le__ and __lt__.
........
2008-06-10 14:40:04 -03:00
|
|
|
connection attempt (if is not specified, the global default timeout setting
|
2011-02-28 15:19:51 -04:00
|
|
|
will be used). *source_address* is a 2-tuple ``(host, port)`` for the socket
|
|
|
|
to bind to as its source address before connecting.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-05-10 11:53:29 -03:00
|
|
|
:class:`FTP` class supports the :keyword:`with` statement. Here is a sample
|
|
|
|
on how using it:
|
|
|
|
|
|
|
|
>>> from ftplib import FTP
|
|
|
|
>>> with FTP("ftp1.at.proftpd.org") as ftp:
|
|
|
|
... ftp.login()
|
|
|
|
... ftp.dir()
|
|
|
|
...
|
|
|
|
'230 Anonymous login ok, restrictions apply.'
|
|
|
|
dr-xr-xr-x 9 ftp ftp 154 May 6 10:43 .
|
|
|
|
dr-xr-xr-x 9 ftp ftp 154 May 6 10:43 ..
|
|
|
|
dr-xr-xr-x 5 ftp ftp 4096 May 6 10:43 CentOS
|
|
|
|
dr-xr-xr-x 3 ftp ftp 18 Jul 10 2008 Fedora
|
|
|
|
>>>
|
|
|
|
|
|
|
|
.. versionchanged:: 3.2
|
|
|
|
Support for the :keyword:`with` statement was added.
|
|
|
|
|
2011-02-28 15:19:51 -04:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
*source_address* parameter was added.
|
2010-05-10 11:53:29 -03:00
|
|
|
|
2011-02-28 15:19:51 -04:00
|
|
|
|
|
|
|
.. class:: FTP_TLS(host='', user='', passwd='', acct='', keyfile=None, certfile=None, context=None, timeout=None, source_address=None)
|
2009-11-17 16:21:14 -04:00
|
|
|
|
|
|
|
A :class:`FTP` subclass which adds TLS support to FTP as described in
|
|
|
|
:rfc:`4217`.
|
|
|
|
Connect as usual to port 21 implicitly securing the FTP control connection
|
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
partially before. Also add a comment describing how this might have to work
with different versions of the interpreter.
........
r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line
Fixed typo
........
r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line
#7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line
Add note about usage of STRINGLIB_EMPTY.
........
r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line
Fix internal reference.
........
r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines
data descriptors do not override the class dictionary if __get__ is not defined
Adjust documentation and add a test to verify this behavior.
See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
discussion.
........
r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines
Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them. That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
........
r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line
Add two more test_strtod test values.
........
r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line
#7762: fix refcount annotation of PyUnicode_Tailmatch().
........
r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line
#7725: fix referencing issue.
........
r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line
mention from_float() in error message
........
r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line
#7802: fix invalid example (heh).
........
r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines
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
........
r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line
Minor modification to unittest documentation.
........
2010-02-02 22:35:45 -04:00
|
|
|
before authenticating. Securing the data connection requires the user to
|
|
|
|
explicitly ask for it by calling the :meth:`prot_p` method.
|
|
|
|
*keyfile* and *certfile* are optional -- they can contain a PEM formatted
|
|
|
|
private key and certificate chain file name for the SSL connection.
|
2010-05-26 15:06:04 -03:00
|
|
|
*context* parameter is a :class:`ssl.SSLContext` object which allows
|
|
|
|
bundling SSL configuration options, certificates and private keys into a
|
2011-02-28 15:19:51 -04:00
|
|
|
single (potentially long-lived) structure. *source_address* is a 2-tuple
|
|
|
|
``(host, port)`` for the socket to bind to as its source address before
|
|
|
|
connecting.
|
2009-11-17 16:21:14 -04:00
|
|
|
|
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
partially before. Also add a comment describing how this might have to work
with different versions of the interpreter.
........
r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line
Fixed typo
........
r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line
#7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line
Add note about usage of STRINGLIB_EMPTY.
........
r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line
Fix internal reference.
........
r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines
data descriptors do not override the class dictionary if __get__ is not defined
Adjust documentation and add a test to verify this behavior.
See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
discussion.
........
r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines
Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them. That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
........
r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line
Add two more test_strtod test values.
........
r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line
#7762: fix refcount annotation of PyUnicode_Tailmatch().
........
r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line
#7725: fix referencing issue.
........
r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line
mention from_float() in error message
........
r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line
#7802: fix invalid example (heh).
........
r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines
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
........
r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line
Minor modification to unittest documentation.
........
2010-02-02 22:35:45 -04:00
|
|
|
.. versionadded:: 3.2
|
2009-11-17 16:21:14 -04:00
|
|
|
|
2011-02-28 15:19:51 -04:00
|
|
|
.. versionchanged:: 3.3
|
|
|
|
*source_address* parameter was added.
|
|
|
|
|
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
partially before. Also add a comment describing how this might have to work
with different versions of the interpreter.
........
r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line
Fixed typo
........
r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line
#7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line
Add note about usage of STRINGLIB_EMPTY.
........
r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line
Fix internal reference.
........
r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines
data descriptors do not override the class dictionary if __get__ is not defined
Adjust documentation and add a test to verify this behavior.
See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
discussion.
........
r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines
Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them. That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
........
r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line
Add two more test_strtod test values.
........
r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line
#7762: fix refcount annotation of PyUnicode_Tailmatch().
........
r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line
#7725: fix referencing issue.
........
r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line
mention from_float() in error message
........
r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line
#7802: fix invalid example (heh).
........
r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines
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
........
r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line
Minor modification to unittest documentation.
........
2010-02-02 22:35:45 -04:00
|
|
|
Here's a sample session using the :class:`FTP_TLS` class:
|
2009-11-17 16:21:14 -04:00
|
|
|
|
|
|
|
>>> from ftplib import FTP_TLS
|
|
|
|
>>> ftps = FTP_TLS('ftp.python.org')
|
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
partially before. Also add a comment describing how this might have to work
with different versions of the interpreter.
........
r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line
Fixed typo
........
r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line
#7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line
Add note about usage of STRINGLIB_EMPTY.
........
r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line
Fix internal reference.
........
r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines
data descriptors do not override the class dictionary if __get__ is not defined
Adjust documentation and add a test to verify this behavior.
See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
discussion.
........
r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines
Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them. That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
........
r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line
Add two more test_strtod test values.
........
r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line
#7762: fix refcount annotation of PyUnicode_Tailmatch().
........
r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line
#7725: fix referencing issue.
........
r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line
mention from_float() in error message
........
r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line
#7802: fix invalid example (heh).
........
r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines
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
........
r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line
Minor modification to unittest documentation.
........
2010-02-02 22:35:45 -04:00
|
|
|
>>> ftps.login() # login anonymously before securing control channel
|
|
|
|
>>> ftps.prot_p() # switch to secure data connection
|
|
|
|
>>> ftps.retrlines('LIST') # list directory content securely
|
2009-11-17 16:21:14 -04:00
|
|
|
total 9
|
|
|
|
drwxr-xr-x 8 root wheel 1024 Jan 3 1994 .
|
|
|
|
drwxr-xr-x 8 root wheel 1024 Jan 3 1994 ..
|
|
|
|
drwxr-xr-x 2 root wheel 1024 Jan 3 1994 bin
|
|
|
|
drwxr-xr-x 2 root wheel 1024 Jan 3 1994 etc
|
|
|
|
d-wxrwxr-x 2 ftp wheel 1024 Sep 5 13:43 incoming
|
|
|
|
drwxr-xr-x 2 root wheel 1024 Nov 17 1993 lib
|
|
|
|
drwxr-xr-x 6 1094 wheel 1024 Sep 13 19:07 pub
|
|
|
|
drwxr-xr-x 3 root wheel 1024 Jan 3 1994 usr
|
|
|
|
-rw-r--r-- 1 root root 312 Aug 1 1994 welcome.msg
|
|
|
|
'226 Transfer complete.'
|
|
|
|
>>> ftps.quit()
|
|
|
|
>>>
|
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. exception:: error_reply
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
Exception raised when an unexpected reply is received from the server.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. exception:: error_temp
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-10-15 16:46:19 -03:00
|
|
|
Exception raised when an error code signifying a temporary error (response
|
|
|
|
codes in the range 400--499) is received.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. exception:: error_perm
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-10-15 16:46:19 -03:00
|
|
|
Exception raised when an error code signifying a permanent error (response
|
|
|
|
codes in the range 500--599) is received.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. exception:: error_proto
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-10-15 16:46:19 -03:00
|
|
|
Exception raised when a reply is received from the server that does not fit
|
|
|
|
the response specifications of the File Transfer Protocol, i.e. begin with a
|
|
|
|
digit in the range 1--5.
|
|
|
|
|
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
partially before. Also add a comment describing how this might have to work
with different versions of the interpreter.
........
r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line
Fixed typo
........
r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line
#7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line
Add note about usage of STRINGLIB_EMPTY.
........
r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line
Fix internal reference.
........
r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines
data descriptors do not override the class dictionary if __get__ is not defined
Adjust documentation and add a test to verify this behavior.
See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
discussion.
........
r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines
Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them. That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
........
r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line
Add two more test_strtod test values.
........
r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line
#7762: fix refcount annotation of PyUnicode_Tailmatch().
........
r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line
#7725: fix referencing issue.
........
r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line
mention from_float() in error message
........
r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line
#7802: fix invalid example (heh).
........
r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines
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
........
r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line
Minor modification to unittest documentation.
........
2010-02-02 22:35:45 -04:00
|
|
|
|
|
|
|
.. data:: all_errors
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
partially before. Also add a comment describing how this might have to work
with different versions of the interpreter.
........
r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line
Fixed typo
........
r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line
#7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line
Add note about usage of STRINGLIB_EMPTY.
........
r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line
Fix internal reference.
........
r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines
data descriptors do not override the class dictionary if __get__ is not defined
Adjust documentation and add a test to verify this behavior.
See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
discussion.
........
r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines
Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them. That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
........
r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line
Add two more test_strtod test values.
........
r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line
#7762: fix refcount annotation of PyUnicode_Tailmatch().
........
r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line
#7725: fix referencing issue.
........
r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line
mention from_float() in error message
........
r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line
#7802: fix invalid example (heh).
........
r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines
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
........
r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line
Minor modification to unittest documentation.
........
2010-02-02 22:35:45 -04:00
|
|
|
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
|
Merged revisions 80030,80067,80069,80080-80081,80084,80432-80433,80465-80470,81059,81065-81067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80030 | georg.brandl | 2010-04-13 08:43:54 +0200 (Di, 13 Apr 2010) | 1 line
Get rid of multi-row cells.
........
r80067 | georg.brandl | 2010-04-14 10:53:38 +0200 (Mi, 14 Apr 2010) | 1 line
#5341: typo.
........
r80069 | georg.brandl | 2010-04-14 15:50:31 +0200 (Mi, 14 Apr 2010) | 1 line
Add an x-ref to where the O_ constants are documented and move the SEEK_ constants after lseek().
........
r80080 | georg.brandl | 2010-04-14 21:16:38 +0200 (Mi, 14 Apr 2010) | 1 line
#8399: add note about Windows and O_BINARY.
........
r80081 | georg.brandl | 2010-04-14 23:34:44 +0200 (Mi, 14 Apr 2010) | 1 line
#5250: document __instancecheck__ and __subclasscheck__. I hope the part about the class/metaclass distinction is understandable.
........
r80084 | georg.brandl | 2010-04-14 23:46:45 +0200 (Mi, 14 Apr 2010) | 1 line
Fix missing.
........
r80432 | georg.brandl | 2010-04-24 10:56:58 +0200 (Sa, 24 Apr 2010) | 1 line
Markup fixes.
........
r80433 | georg.brandl | 2010-04-24 11:08:10 +0200 (Sa, 24 Apr 2010) | 1 line
#7507: quote "!" in pipes.quote(); it is a special character for some shells.
........
r80465 | georg.brandl | 2010-04-25 12:29:17 +0200 (So, 25 Apr 2010) | 1 line
Remove LaTeXy index entry syntax.
........
r80466 | georg.brandl | 2010-04-25 12:54:42 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Better cross-referencing in socket and winreg docs.
........
r80467 | georg.brandl | 2010-04-25 12:55:16 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Remove reference to winreg being the fabled high-level registry interface.
........
r80468 | georg.brandl | 2010-04-25 12:55:58 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Minor spelling changes to _winreg docs.
........
r80469 | georg.brandl | 2010-04-25 12:56:41 +0200 (So, 25 Apr 2010) | 1 line
Fix code example to have valid syntax so that it can be highlighted.
........
r80470 | georg.brandl | 2010-04-25 12:57:15 +0200 (So, 25 Apr 2010) | 1 line
Patch from Tim Hatch: Make socket setblocking <-> settimeout examples symmetric.
........
r81059 | georg.brandl | 2010-05-10 23:02:51 +0200 (Mo, 10 Mai 2010) | 1 line
#8642: fix wrong function name.
........
r81065 | georg.brandl | 2010-05-10 23:46:50 +0200 (Mo, 10 Mai 2010) | 1 line
Fix reference direction.
........
r81066 | georg.brandl | 2010-05-10 23:50:57 +0200 (Mo, 10 Mai 2010) | 1 line
Consolidate deprecation messages.
........
r81067 | georg.brandl | 2010-05-10 23:51:33 +0200 (Mo, 10 Mai 2010) | 1 line
Fix typo.
........
2010-05-19 17:57:08 -03:00
|
|
|
four exceptions listed above as well as :exc:`socket.error` and
|
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines
Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done
partially before. Also add a comment describing how this might have to work
with different versions of the interpreter.
........
r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line
Fixed typo
........
r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line
#7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such.
........
r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line
Add note about usage of STRINGLIB_EMPTY.
........
r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line
Fix internal reference.
........
r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines
data descriptors do not override the class dictionary if __get__ is not defined
Adjust documentation and add a test to verify this behavior.
See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for
discussion.
........
r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines
Do not compile stubs for the sha2 series hashes in the openssl hashlib
module when the openssl version is too old to support them. That
leads both compiled code bloat and to unittests attempting to test
implementations that don't exist for comparison purposes on such
platforms.
........
r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line
Add two more test_strtod test values.
........
r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line
#7762: fix refcount annotation of PyUnicode_Tailmatch().
........
r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line
#7725: fix referencing issue.
........
r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line
mention from_float() in error message
........
r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line
#7802: fix invalid example (heh).
........
r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines
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
........
r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line
Minor modification to unittest documentation.
........
2010-02-02 22:35:45 -04:00
|
|
|
:exc:`IOError`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-10-15 16:46:19 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
Module :mod:`netrc`
|
2009-05-17 10:00:36 -03:00
|
|
|
Parser for the :file:`.netrc` file format. The file :file:`.netrc` is
|
|
|
|
typically used by FTP clients to load user authentication information
|
|
|
|
before prompting the user.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. index:: single: ftpmirror.py
|
|
|
|
|
|
|
|
The file :file:`Tools/scripts/ftpmirror.py` in the Python source distribution is
|
|
|
|
a script that can mirror FTP sites, or portions thereof, using the :mod:`ftplib`
|
|
|
|
module. It can be used as an extended example that applies this module.
|
|
|
|
|
|
|
|
|
|
|
|
.. _ftp-objects:
|
|
|
|
|
|
|
|
FTP Objects
|
|
|
|
-----------
|
|
|
|
|
|
|
|
Several methods are available in two flavors: one for handling text files and
|
|
|
|
another for binary files. These are named for the command which is used
|
|
|
|
followed by ``lines`` for the text version or ``binary`` for the binary version.
|
|
|
|
|
|
|
|
:class:`FTP` instances have the following methods:
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.set_debuglevel(level)
|
|
|
|
|
|
|
|
Set the instance's debugging level. This controls the amount of debugging
|
|
|
|
output printed. The default, ``0``, produces no debugging output. A value of
|
|
|
|
``1`` produces a moderate amount of debugging output, generally a single line
|
|
|
|
per request. A value of ``2`` or higher produces the maximum amount of
|
|
|
|
debugging output, logging each line sent and received on the control connection.
|
|
|
|
|
|
|
|
|
2011-02-28 15:19:51 -04:00
|
|
|
.. method:: FTP.connect(host='', port=0, timeout=None, source_address=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Connect to the given host and port. The default port number is ``21``, as
|
|
|
|
specified by the FTP protocol specification. It is rarely needed to specify a
|
|
|
|
different port number. This function should be called only once for each
|
|
|
|
instance; it should not be called at all if a host was given when the instance
|
|
|
|
was created. All other methods can only be used after a connection has been
|
|
|
|
made.
|
|
|
|
The optional *timeout* parameter specifies a timeout in seconds for the
|
Merged revisions 63562,63570,63728,63734,63784,63788,63802,63817,63827,63839,63887,63975,63998 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63562 | martin.v.loewis | 2008-05-23 17:06:50 +0200 (Fri, 23 May 2008) | 2 lines
Patch #1722225: Support QNX 6.
........
r63570 | trent.nelson | 2008-05-23 22:33:14 +0200 (Fri, 23 May 2008) | 1 line
Introduce a user macro named $(externalsDir), which should point to the root directory of where all the external sources should live. Developers can change this value if their external sources live elsewhere. The default of '..\..' matches the current status quo.
........
r63728 | gregory.p.smith | 2008-05-26 23:16:34 +0200 (Mon, 26 May 2008) | 4 lines
Fix issue2589: there was a potential integer overflow leading to
memory corruption on esoteric platforms and incorrect behavior on
normal platforms.
........
r63734 | gregory.p.smith | 2008-05-27 00:07:28 +0200 (Tue, 27 May 2008) | 3 lines
Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is
passed in. (The assert won't prevent this in non-debug builds).
........
r63784 | raymond.hettinger | 2008-05-29 10:38:23 +0200 (Thu, 29 May 2008) | 1 line
Fix two typos.
........
r63788 | facundo.batista | 2008-05-29 18:39:26 +0200 (Thu, 29 May 2008) | 6 lines
Fixed the semantic of timeout for socket.create_connection and
all the upper level libraries that use it, including urllib2.
Added and fixed some tests, and changed docs correspondingly.
Thanks to John J Lee for the patch and the pusing, :)
........
r63802 | mark.dickinson | 2008-05-30 04:46:53 +0200 (Fri, 30 May 2008) | 2 lines
Fix typo in testSum
........
r63817 | raymond.hettinger | 2008-05-30 20:20:50 +0200 (Fri, 30 May 2008) | 8 lines
* Mark intermedidate computes values (hi, lo, yr) as volatile.
* Expand comments.
* Swap variable names in the sum_exact code so that x and y
are consistently chosen as the larger and smaller magnitude
values respectively.
........
r63827 | raymond.hettinger | 2008-05-31 05:24:31 +0200 (Sat, 31 May 2008) | 1 line
Implement heapq in terms of less-than (to match list.sort()).
........
r63839 | gerhard.haering | 2008-05-31 23:33:27 +0200 (Sat, 31 May 2008) | 2 lines
Fixed rowcount for SELECT statements. They're -1 now (again), for better DB-API 2.0 compliance.
........
r63887 | gregory.p.smith | 2008-06-02 06:05:52 +0200 (Mon, 02 Jun 2008) | 4 lines
Fix issue 2782: be less strict about the format string type in strftime.
Accept unicode and anything else ParseTuple "s#" can deal with. This
matches the time.strftime behavior.
........
r63975 | neal.norwitz | 2008-06-06 06:47:01 +0200 (Fri, 06 Jun 2008) | 3 lines
Aldo Cortesi confirmed this is still needed for OpenBSD 4.2 and 4.3.
(I didn't regen configure, since I don't have a working autoconf.)
........
r63998 | raymond.hettinger | 2008-06-06 23:47:51 +0200 (Fri, 06 Jun 2008) | 1 line
Issue 3501: Make heapq support both __le__ and __lt__.
........
2008-06-10 14:40:04 -03:00
|
|
|
connection attempt. If no *timeout* is passed, the global default timeout
|
|
|
|
setting will be used.
|
2011-02-28 15:19:51 -04:00
|
|
|
*source_address* is a 2-tuple ``(host, port)`` for the socket to bind to as
|
|
|
|
its source address before connecting.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.3
|
|
|
|
*source_address* parameter was added.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.getwelcome()
|
|
|
|
|
|
|
|
Return the welcome message sent by the server in reply to the initial
|
|
|
|
connection. (This message sometimes contains disclaimers or help information
|
|
|
|
that may be relevant to the user.)
|
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. method:: FTP.login(user='anonymous', passwd='', acct='')
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Log in as the given *user*. The *passwd* and *acct* parameters are optional and
|
|
|
|
default to the empty string. If no *user* is specified, it defaults to
|
|
|
|
``'anonymous'``. If *user* is ``'anonymous'``, the default *passwd* is
|
|
|
|
``'anonymous@'``. This function should be called only once for each instance,
|
|
|
|
after a connection has been established; it should not be called at all if a
|
|
|
|
host and user were given when the instance was created. Most FTP commands are
|
Merged revisions 74277,74321,74323,74326,74355,74465,74467,74488,74492,74513,74531,74549,74553,74625,74632,74643-74644,74647,74652,74666,74671,74727,74739 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74277 | sean.reifschneider | 2009-08-01 18:54:55 -0500 (Sat, 01 Aug 2009) | 3 lines
- Issue #6624: yArg_ParseTuple with "s" format when parsing argument with
NUL: Bogus TypeError detail string.
........
r74321 | guilherme.polo | 2009-08-05 11:51:41 -0500 (Wed, 05 Aug 2009) | 1 line
Easier reference to find (at least while svn continues being used).
........
r74323 | guilherme.polo | 2009-08-05 18:48:26 -0500 (Wed, 05 Aug 2009) | 1 line
Typo.
........
r74326 | jesse.noller | 2009-08-05 21:05:56 -0500 (Wed, 05 Aug 2009) | 1 line
Fix issue 4660: spurious task_done errors in multiprocessing, remove doc note for from_address
........
r74355 | gregory.p.smith | 2009-08-12 12:02:37 -0500 (Wed, 12 Aug 2009) | 2 lines
comment typo fix
........
r74465 | vinay.sajip | 2009-08-15 18:23:12 -0500 (Sat, 15 Aug 2009) | 1 line
Added section on logging to one file from multiple processes.
........
r74467 | vinay.sajip | 2009-08-15 18:34:47 -0500 (Sat, 15 Aug 2009) | 1 line
Refined section on logging to one file from multiple processes.
........
r74488 | vinay.sajip | 2009-08-17 08:14:37 -0500 (Mon, 17 Aug 2009) | 1 line
Further refined section on logging to one file from multiple processes.
........
r74492 | r.david.murray | 2009-08-17 14:26:49 -0500 (Mon, 17 Aug 2009) | 2 lines
Issue 6685: 'toupper' -> 'upper' in cgi doc example explanation.
........
r74513 | skip.montanaro | 2009-08-18 09:37:52 -0500 (Tue, 18 Aug 2009) | 1 line
missing module ref (issue6723)
........
r74531 | vinay.sajip | 2009-08-20 17:04:32 -0500 (Thu, 20 Aug 2009) | 1 line
Added section on exceptions raised during logging.
........
r74549 | benjamin.peterson | 2009-08-24 12:42:36 -0500 (Mon, 24 Aug 2009) | 1 line
fix pdf building by teaching latex the right encoding package
........
r74553 | r.david.murray | 2009-08-26 20:04:59 -0500 (Wed, 26 Aug 2009) | 2 lines
Remove leftover text from end of sentence.
........
r74625 | benjamin.peterson | 2009-09-01 17:27:57 -0500 (Tue, 01 Sep 2009) | 1 line
remove the check that classmethod's argument is a callable
........
r74632 | georg.brandl | 2009-09-03 02:27:26 -0500 (Thu, 03 Sep 2009) | 1 line
#6828: fix wrongly highlighted blocks.
........
r74643 | georg.brandl | 2009-09-04 01:59:20 -0500 (Fri, 04 Sep 2009) | 2 lines
Issue #2666: Handle BROWSER environment variable properly for unknown browser names in the webbrowser module.
........
r74644 | georg.brandl | 2009-09-04 02:55:14 -0500 (Fri, 04 Sep 2009) | 1 line
#5047: remove Monterey support from configure.
........
r74647 | georg.brandl | 2009-09-04 03:17:04 -0500 (Fri, 04 Sep 2009) | 2 lines
Issue #5275: In Cookie's Cookie.load(), properly handle non-string arguments as documented.
........
r74652 | georg.brandl | 2009-09-04 06:25:37 -0500 (Fri, 04 Sep 2009) | 1 line
#6756: add some info about the "acct" parameter.
........
r74666 | georg.brandl | 2009-09-05 04:04:09 -0500 (Sat, 05 Sep 2009) | 1 line
#6841: remove duplicated word.
........
r74671 | georg.brandl | 2009-09-05 11:47:17 -0500 (Sat, 05 Sep 2009) | 1 line
#6843: add link from filterwarnings to where the meaning of the arguments is covered.
........
r74727 | benjamin.peterson | 2009-09-08 18:04:22 -0500 (Tue, 08 Sep 2009) | 1 line
#6865 fix ref counting in initialization of pwd module
........
r74739 | georg.brandl | 2009-09-11 02:55:20 -0500 (Fri, 11 Sep 2009) | 1 line
Move function back to its section.
........
2009-09-11 19:24:02 -03:00
|
|
|
only allowed after the client has logged in. The *acct* parameter supplies
|
|
|
|
"accounting information"; few systems implement this.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.abort()
|
|
|
|
|
|
|
|
Abort a file transfer that is in progress. Using this does not always work, but
|
|
|
|
it's worth a try.
|
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. method:: FTP.sendcmd(cmd)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Send a simple command string to the server and return the response string.
|
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. method:: FTP.voidcmd(cmd)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-10-15 16:46:19 -03:00
|
|
|
Send a simple command string to the server and handle the response. Return
|
|
|
|
nothing if a response code corresponding to success (codes in the range
|
|
|
|
200--299) is received. Raise :exc:`error_reply` otherwise.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. method:: FTP.retrbinary(cmd, callback, blocksize=8192, rest=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
Retrieve a file in binary transfer mode. *cmd* should be an appropriate
|
2007-08-15 11:28:22 -03:00
|
|
|
``RETR`` command: ``'RETR filename'``. The *callback* function is called for
|
|
|
|
each block of data received, with a single string argument giving the data
|
2009-05-17 10:00:36 -03:00
|
|
|
block. The optional *blocksize* argument specifies the maximum chunk size to
|
2007-08-15 11:28:22 -03:00
|
|
|
read on the low-level socket object created to do the actual transfer (which
|
|
|
|
will also be the largest size of the data blocks passed to *callback*). A
|
|
|
|
reasonable default is chosen. *rest* means the same thing as in the
|
|
|
|
:meth:`transfercmd` method.
|
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. method:: FTP.retrlines(cmd, callback=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2010-10-15 16:46:19 -03:00
|
|
|
Retrieve a file or directory listing in ASCII transfer mode. *cmd* should be
|
|
|
|
an appropriate ``RETR`` command (see :meth:`retrbinary`) or a command such as
|
2011-05-06 14:49:08 -03:00
|
|
|
``LIST`` or ``NLST`` (usually just the string ``'LIST'``).
|
2010-10-15 16:46:19 -03:00
|
|
|
``LIST`` retrieves a list of files and information about those files.
|
2011-05-06 14:49:08 -03:00
|
|
|
``NLST`` retrieves a list of file names.
|
|
|
|
The *callback* function is called for each line with a string argument
|
|
|
|
containing the line with the trailing CRLF stripped. The default *callback*
|
|
|
|
prints the line to ``sys.stdout``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.set_pasv(boolean)
|
|
|
|
|
2008-05-12 15:05:20 -03:00
|
|
|
Enable "passive" mode if *boolean* is true, other disable passive mode.
|
|
|
|
Passive mode is on by default.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-11-27 09:23:26 -04:00
|
|
|
.. method:: FTP.storbinary(cmd, file, blocksize=8192, callback=None, rest=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
Store a file in binary transfer mode. *cmd* should be an appropriate
|
2010-09-15 08:11:28 -03:00
|
|
|
``STOR`` command: ``"STOR filename"``. *file* is an open :term:`file object`
|
|
|
|
which is read until EOF using its :meth:`read` method in blocks of size
|
|
|
|
*blocksize* to provide the data to be stored. The *blocksize* argument
|
|
|
|
defaults to 8192. *callback* is an optional single parameter callable that
|
|
|
|
is called on each block of data after it is sent. *rest* means the same thing
|
|
|
|
as in the :meth:`transfercmd` method.
|
2009-11-27 09:23:26 -04:00
|
|
|
|
|
|
|
.. versionchanged:: 3.2
|
|
|
|
*rest* parameter added.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. method:: FTP.storlines(cmd, file, callback=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
Store a file in ASCII transfer mode. *cmd* should be an appropriate
|
2007-08-15 11:28:22 -03:00
|
|
|
``STOR`` command (see :meth:`storbinary`). Lines are read until EOF from the
|
2010-09-15 08:11:28 -03:00
|
|
|
open :term:`file object` *file* using its :meth:`readline` method to provide
|
|
|
|
the data to be stored. *callback* is an optional single parameter callable
|
Merged revisions 60284-60349 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60286 | christian.heimes | 2008-01-25 15:54:23 +0100 (Fri, 25 Jan 2008) | 1 line
setup.py doesn't pick up changes to a header file
........
r60287 | christian.heimes | 2008-01-25 16:52:11 +0100 (Fri, 25 Jan 2008) | 2 lines
Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/
It forces a rebuild of all extensions when a header files has been modified
........
r60291 | raymond.hettinger | 2008-01-25 20:24:46 +0100 (Fri, 25 Jan 2008) | 4 lines
Changes 54857 and 54840 broke code and were reverted in Py2.5 just before
it was released, but that reversion never made it to the Py2.6 head.
........
r60296 | guido.van.rossum | 2008-01-25 20:50:26 +0100 (Fri, 25 Jan 2008) | 2 lines
Rewrite the list_inline_repeat overflow check slightly differently.
........
r60301 | thomas.wouters | 2008-01-25 22:09:34 +0100 (Fri, 25 Jan 2008) | 4 lines
Use the right (portable) definition of the max of a Py_ssize_t.
........
r60303 | thomas.wouters | 2008-01-26 02:47:05 +0100 (Sat, 26 Jan 2008) | 5 lines
Make 'testall' work again when building in a separate directory.
test_distutils still fails when doing that.
........
r60305 | neal.norwitz | 2008-01-26 06:54:48 +0100 (Sat, 26 Jan 2008) | 3 lines
Prevent this test from failing if there are transient network problems
by retrying the host for up to 3 times.
........
r60306 | neal.norwitz | 2008-01-26 08:26:12 +0100 (Sat, 26 Jan 2008) | 12 lines
Use a condition variable (threading.Event) rather than sleeps and checking a
global to determine when the server is ready to be used. This slows the test
down, but should make it correct. There was a race condition before where the
server could have assigned a port, yet it wasn't ready to serve requests. If
the client sent a request before the server was completely ready, it would get
an exception. There was machinery to try to handle this condition. All of
that should be unnecessary and removed if this change works. A NOTE was
added as a comment about what needs to be fixed.
The buildbots will tell us if there are more errors or
if this test is now stable.
........
r60307 | neal.norwitz | 2008-01-26 08:38:03 +0100 (Sat, 26 Jan 2008) | 3 lines
Fix exception in tearDown on ppc buildbot. If there's no directory,
that shouldn't cause the test to fail. Just like it setUp.
........
r60308 | raymond.hettinger | 2008-01-26 09:19:06 +0100 (Sat, 26 Jan 2008) | 3 lines
Make PySet_Add() work with frozensets. Works like PyTuple_SetItem() to build-up values in a brand new frozenset.
........
r60309 | neal.norwitz | 2008-01-26 09:26:00 +0100 (Sat, 26 Jan 2008) | 1 line
The OS X buildbot had errors with the unavailable exceptions disabled. Restore it.
........
r60310 | raymond.hettinger | 2008-01-26 09:37:28 +0100 (Sat, 26 Jan 2008) | 4 lines
Let marshal build-up sets and frozensets one element at a time.
Saves the unnecessary creation of a tuple as intermediate container.
........
r60311 | raymond.hettinger | 2008-01-26 09:41:13 +0100 (Sat, 26 Jan 2008) | 1 line
Update test code for change to PySet_Add().
........
r60312 | raymond.hettinger | 2008-01-26 10:31:11 +0100 (Sat, 26 Jan 2008) | 1 line
Revert PySet_Add() changes.
........
r60314 | georg.brandl | 2008-01-26 10:43:35 +0100 (Sat, 26 Jan 2008) | 2 lines
#1934: fix os.path.isabs docs.
........
r60316 | georg.brandl | 2008-01-26 12:00:18 +0100 (Sat, 26 Jan 2008) | 2 lines
Add missing things in re docstring.
........
r60317 | georg.brandl | 2008-01-26 12:02:22 +0100 (Sat, 26 Jan 2008) | 2 lines
Slashes allowed on Windows.
........
r60319 | georg.brandl | 2008-01-26 14:41:21 +0100 (Sat, 26 Jan 2008) | 2 lines
Fix markup again.
........
r60320 | andrew.kuchling | 2008-01-26 14:50:51 +0100 (Sat, 26 Jan 2008) | 1 line
Add some items
........
r60321 | georg.brandl | 2008-01-26 15:02:38 +0100 (Sat, 26 Jan 2008) | 2 lines
Clarify "b" mode under Unix.
........
r60322 | georg.brandl | 2008-01-26 15:03:47 +0100 (Sat, 26 Jan 2008) | 3 lines
#1940: make it possible to use curses.filter() before curses.initscr()
as the documentation says.
........
r60324 | georg.brandl | 2008-01-26 15:14:20 +0100 (Sat, 26 Jan 2008) | 3 lines
#1473257: add generator.gi_code attribute that refers to
the original code object backing the generator. Patch by Collin Winter.
........
r60325 | georg.brandl | 2008-01-26 15:19:22 +0100 (Sat, 26 Jan 2008) | 2 lines
Move C API entries to the corresponding section.
........
r60326 | christian.heimes | 2008-01-26 17:43:35 +0100 (Sat, 26 Jan 2008) | 1 line
Unit test fix from Giampaolo Rodola, #1938
........
r60327 | gregory.p.smith | 2008-01-26 19:51:05 +0100 (Sat, 26 Jan 2008) | 2 lines
Update docs for new callpack params added in r60188
........
r60329 | neal.norwitz | 2008-01-26 21:24:36 +0100 (Sat, 26 Jan 2008) | 3 lines
Cleanup the code a bit. test_rfind is failing on PPC and PPC64 buildbots,
this might fix the problem.
........
r60330 | neal.norwitz | 2008-01-26 22:02:45 +0100 (Sat, 26 Jan 2008) | 1 line
Always try to remove the test file even if close raises an exception
........
r60331 | neal.norwitz | 2008-01-26 22:21:59 +0100 (Sat, 26 Jan 2008) | 3 lines
Reduce the race condition by signalling when the server is ready
and not trying to connect before.
........
r60334 | neal.norwitz | 2008-01-27 00:13:46 +0100 (Sun, 27 Jan 2008) | 5 lines
On some systems (e.g., Ubuntu on hppa) the flush()
doesn't cause the exception, but the close() does.
Will backport.
........
r60335 | neal.norwitz | 2008-01-27 00:14:17 +0100 (Sun, 27 Jan 2008) | 2 lines
Consistently use tempfile.tempdir for the db_home directory.
........
r60338 | neal.norwitz | 2008-01-27 02:44:05 +0100 (Sun, 27 Jan 2008) | 4 lines
Eliminate the sleeps that assume the server will start in .5 seconds.
This should make the test less flaky. It also speeds up the test
by about 75% on my box (20+ seconds -> ~4 seconds).
........
r60342 | neal.norwitz | 2008-01-27 06:02:34 +0100 (Sun, 27 Jan 2008) | 6 lines
Try to prevent this test from being flaky. We might need a sleep in here
which isn't as bad as it sounds. The close() *should* raise an exception,
so if it didn't we should give more time to sync and really raise it.
Will backport.
........
r60344 | jeffrey.yasskin | 2008-01-27 06:40:35 +0100 (Sun, 27 Jan 2008) | 3 lines
Make rational.gcd() public and allow Rational to take decimal strings, per
Raymond's advice.
........
r60345 | neal.norwitz | 2008-01-27 08:36:03 +0100 (Sun, 27 Jan 2008) | 3 lines
Mostly reformat. Also set an error and return NULL if neither MS_WINDOWS
nor UNIX is defined. This may have caused problems on cygwin.
........
r60346 | neal.norwitz | 2008-01-27 08:37:38 +0100 (Sun, 27 Jan 2008) | 3 lines
Use int for the sign rather than a char. char can be signed or unsigned.
It's system dependent. This might fix the problem with test_rfind failing.
........
r60347 | neal.norwitz | 2008-01-27 08:41:33 +0100 (Sun, 27 Jan 2008) | 1 line
Add stdarg include for va_list to get this to compile on cygwin
........
r60348 | raymond.hettinger | 2008-01-27 11:13:57 +0100 (Sun, 27 Jan 2008) | 1 line
Docstring nit
........
r60349 | raymond.hettinger | 2008-01-27 11:47:55 +0100 (Sun, 27 Jan 2008) | 1 line
Removed an unnecessary and confusing paragraph from the namedtuple docs.
........
2008-01-27 11:18:18 -04:00
|
|
|
that is called on each line after it is sent.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. method:: FTP.transfercmd(cmd, rest=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Initiate a transfer over the data connection. If the transfer is active, send a
|
|
|
|
``EPRT`` or ``PORT`` command and the transfer command specified by *cmd*, and
|
|
|
|
accept the connection. If the server is passive, send a ``EPSV`` or ``PASV``
|
|
|
|
command, connect to it, and start the transfer command. Either way, return the
|
|
|
|
socket for the connection.
|
|
|
|
|
|
|
|
If optional *rest* is given, a ``REST`` command is sent to the server, passing
|
|
|
|
*rest* as an argument. *rest* is usually a byte offset into the requested file,
|
|
|
|
telling the server to restart sending the file's bytes at the requested offset,
|
|
|
|
skipping over the initial bytes. Note however that RFC 959 requires only that
|
|
|
|
*rest* be a string containing characters in the printable range from ASCII code
|
|
|
|
33 to ASCII code 126. The :meth:`transfercmd` method, therefore, converts
|
|
|
|
*rest* to a string, but no check is performed on the string's contents. If the
|
|
|
|
server does not recognize the ``REST`` command, an :exc:`error_reply` exception
|
|
|
|
will be raised. If this happens, simply call :meth:`transfercmd` without a
|
|
|
|
*rest* argument.
|
|
|
|
|
|
|
|
|
2009-05-17 10:00:36 -03:00
|
|
|
.. method:: FTP.ntransfercmd(cmd, rest=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Like :meth:`transfercmd`, but returns a tuple of the data connection and the
|
|
|
|
expected size of the data. If the expected size could not be computed, ``None``
|
|
|
|
will be returned as the expected size. *cmd* and *rest* means the same thing as
|
|
|
|
in :meth:`transfercmd`.
|
|
|
|
|
|
|
|
|
2011-05-06 14:49:08 -03:00
|
|
|
.. method:: FTP.mlsd(path="", facts=[])
|
|
|
|
|
|
|
|
List a directory in a standardized format by using MLSD command
|
2011-05-07 11:06:59 -03:00
|
|
|
(:rfc:`3659`). If *path* is omitted the current directory is assumed.
|
2011-05-06 14:49:08 -03:00
|
|
|
*facts* is a list of strings representing the type of information desired
|
2011-05-07 11:06:59 -03:00
|
|
|
(e.g. ``["type", "size", "perm"]``). Return a generator object yielding a
|
|
|
|
tuple of two elements for every file found in path. First element is the
|
|
|
|
file name, the second one is a dictionary containing facts about the file
|
|
|
|
name. Content of this dictionary might be limited by the *facts* argument
|
|
|
|
but server is not guaranteed to return all requested facts.
|
2011-05-06 14:49:08 -03:00
|
|
|
|
|
|
|
.. versionadded:: 3.3
|
|
|
|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. method:: FTP.nlst(argument[, ...])
|
|
|
|
|
2010-10-15 16:46:19 -03:00
|
|
|
Return a list of file names as returned by the ``NLST`` command. The
|
|
|
|
optional *argument* is a directory to list (default is the current server
|
|
|
|
directory). Multiple arguments can be used to pass non-standard options to
|
|
|
|
the ``NLST`` command.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-05-07 11:06:59 -03:00
|
|
|
.. deprecated:: 3.3 use :meth:`mlsd` instead.
|
2011-05-06 14:49:08 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. method:: FTP.dir(argument[, ...])
|
|
|
|
|
|
|
|
Produce a directory listing as returned by the ``LIST`` command, printing it to
|
|
|
|
standard output. The optional *argument* is a directory to list (default is the
|
|
|
|
current server directory). Multiple arguments can be used to pass non-standard
|
|
|
|
options to the ``LIST`` command. If the last argument is a function, it is used
|
|
|
|
as a *callback* function as for :meth:`retrlines`; the default prints to
|
|
|
|
``sys.stdout``. This method returns ``None``.
|
|
|
|
|
2011-05-07 11:06:59 -03:00
|
|
|
.. deprecated:: 3.3 use :meth:`mlsd` instead.
|
2011-05-06 14:49:08 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. method:: FTP.rename(fromname, toname)
|
|
|
|
|
|
|
|
Rename file *fromname* on the server to *toname*.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.delete(filename)
|
|
|
|
|
|
|
|
Remove the file named *filename* from the server. If successful, returns the
|
|
|
|
text of the response, otherwise raises :exc:`error_perm` on permission errors or
|
|
|
|
:exc:`error_reply` on other errors.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.cwd(pathname)
|
|
|
|
|
|
|
|
Set the current directory on the server.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.mkd(pathname)
|
|
|
|
|
|
|
|
Create a new directory on the server.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.pwd()
|
|
|
|
|
|
|
|
Return the pathname of the current directory on the server.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.rmd(dirname)
|
|
|
|
|
|
|
|
Remove the directory named *dirname* on the server.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.size(filename)
|
|
|
|
|
|
|
|
Request the size of the file named *filename* on the server. On success, the
|
|
|
|
size of the file is returned as an integer, otherwise ``None`` is returned.
|
|
|
|
Note that the ``SIZE`` command is not standardized, but is supported by many
|
|
|
|
common server implementations.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.quit()
|
|
|
|
|
|
|
|
Send a ``QUIT`` command to the server and close the connection. This is the
|
2008-10-10 21:49:57 -03:00
|
|
|
"polite" way to close a connection, but it may raise an exception if the server
|
Merged revisions 64722,64729,64753,64845-64846,64849,64871,64880-64882,64885,64888,64897,64900-64901,64915,64926-64929,64938-64941,64944,64961,64966,64973 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r64722 | georg.brandl | 2008-07-05 12:13:36 +0200 (Sat, 05 Jul 2008) | 4 lines
#2663: support an *ignore* argument to shutil.copytree(). Patch by Tarek Ziade.
This is a new feature, but Barry authorized adding it in the beta period.
........
r64729 | mark.dickinson | 2008-07-05 13:33:52 +0200 (Sat, 05 Jul 2008) | 5 lines
Issue 3188: accept float('infinity') as well as float('inf'). This
makes the float constructor behave in the same way as specified
by various other language standards, including C99, IEEE 754r,
and the IBM Decimal standard.
........
r64753 | gregory.p.smith | 2008-07-06 05:35:58 +0200 (Sun, 06 Jul 2008) | 4 lines
- Issue #2862: Make int and float freelist management consistent with other
freelists. Changes their CompactFreeList apis into ClearFreeList apis and
calls them via gc.collect().
........
r64845 | raymond.hettinger | 2008-07-10 16:03:19 +0200 (Thu, 10 Jul 2008) | 1 line
Issue 3301: Bisect functions behaved badly when lo was negative.
........
r64846 | raymond.hettinger | 2008-07-10 16:34:57 +0200 (Thu, 10 Jul 2008) | 1 line
Issue 3285: Fractions from_float() and from_decimal() accept Integral arguments.
........
r64849 | andrew.kuchling | 2008-07-10 16:43:31 +0200 (Thu, 10 Jul 2008) | 1 line
Wording changes
........
r64871 | raymond.hettinger | 2008-07-11 14:00:21 +0200 (Fri, 11 Jul 2008) | 1 line
Add cautionary note on the use of PySequence_Fast_ITEMS.
........
r64880 | amaury.forgeotdarc | 2008-07-11 23:28:25 +0200 (Fri, 11 Jul 2008) | 5 lines
#3317 in zipfile module, restore the previous names of global variables:
some applications relied on them.
Also remove duplicated lines.
........
r64881 | amaury.forgeotdarc | 2008-07-11 23:45:06 +0200 (Fri, 11 Jul 2008) | 3 lines
#3342: In tracebacks, printed source lines were not indented since r62555.
#3343: Py_DisplaySourceLine should be a private function. Rename it to _Py_DisplaySourceLine.
........
r64882 | josiah.carlson | 2008-07-12 00:17:14 +0200 (Sat, 12 Jul 2008) | 2 lines
Fix for the AttributeError in test_asynchat.
........
r64885 | josiah.carlson | 2008-07-12 01:26:59 +0200 (Sat, 12 Jul 2008) | 2 lines
Fixed test for asyncore.
........
r64888 | matthias.klose | 2008-07-12 09:51:48 +0200 (Sat, 12 Jul 2008) | 2 lines
- Fix bashisms in Tools/faqwiz/move-faqwiz.sh
........
r64897 | benjamin.peterson | 2008-07-12 22:16:19 +0200 (Sat, 12 Jul 2008) | 1 line
fix various doc typos #3320
........
r64900 | alexandre.vassalotti | 2008-07-13 00:06:53 +0200 (Sun, 13 Jul 2008) | 2 lines
Fixed typo.
........
r64901 | benjamin.peterson | 2008-07-13 01:41:19 +0200 (Sun, 13 Jul 2008) | 1 line
#1778443 robotparser fixes from Aristotelis Mikropoulos
........
r64915 | nick.coghlan | 2008-07-13 16:52:36 +0200 (Sun, 13 Jul 2008) | 1 line
Fix issue 3221 by emitting a RuntimeWarning instead of raising SystemError when the parent module can't be found during an absolute import (likely due to non-PEP 361 aware code which sets a module level __package__ attribute)
........
r64926 | martin.v.loewis | 2008-07-13 22:31:49 +0200 (Sun, 13 Jul 2008) | 2 lines
Add turtle into the module index.
........
r64927 | alexandre.vassalotti | 2008-07-13 22:42:44 +0200 (Sun, 13 Jul 2008) | 3 lines
Issue #3274: Use a less common identifier for the temporary variable
in Py_CLEAR().
........
r64928 | andrew.kuchling | 2008-07-13 23:43:25 +0200 (Sun, 13 Jul 2008) | 1 line
Re-word
........
r64929 | andrew.kuchling | 2008-07-13 23:43:52 +0200 (Sun, 13 Jul 2008) | 1 line
Add various items; move ctypes items into a subsection of their own
........
r64938 | andrew.kuchling | 2008-07-14 02:35:32 +0200 (Mon, 14 Jul 2008) | 1 line
Typo fixes
........
r64939 | andrew.kuchling | 2008-07-14 02:40:55 +0200 (Mon, 14 Jul 2008) | 1 line
Typo fix
........
r64940 | andrew.kuchling | 2008-07-14 03:18:16 +0200 (Mon, 14 Jul 2008) | 1 line
Typo fix
........
r64941 | andrew.kuchling | 2008-07-14 03:18:31 +0200 (Mon, 14 Jul 2008) | 1 line
Expand the multiprocessing section
........
r64944 | gregory.p.smith | 2008-07-14 08:06:48 +0200 (Mon, 14 Jul 2008) | 7 lines
Fix posix.fork1() / os.fork1() to only call PyOS_AfterFork() in the child
process rather than both parent and child.
Does anyone actually use fork1()? It appears to be a Solaris thing
but if Python is built with pthreads on Solaris, fork1() and fork()
should be the same.
........
r64961 | jesse.noller | 2008-07-15 15:47:33 +0200 (Tue, 15 Jul 2008) | 1 line
multiprocessing/connection.py patch to remove fqdn oddness for issue 3270
........
r64966 | nick.coghlan | 2008-07-15 17:40:22 +0200 (Tue, 15 Jul 2008) | 1 line
Add missing NEWS entry for r64962
........
r64973 | jesse.noller | 2008-07-15 20:29:18 +0200 (Tue, 15 Jul 2008) | 1 line
Revert 3270 patch: self._address is in pretty widespread use, need to revisit
........
2008-07-16 09:55:28 -03:00
|
|
|
responds with an error to the ``QUIT`` command. This implies a call to the
|
2007-08-15 11:28:22 -03:00
|
|
|
:meth:`close` method which renders the :class:`FTP` instance useless for
|
|
|
|
subsequent calls (see below).
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: FTP.close()
|
|
|
|
|
|
|
|
Close the connection unilaterally. This should not be applied to an already
|
|
|
|
closed connection such as after a successful call to :meth:`quit`. After this
|
|
|
|
call the :class:`FTP` instance should not be used any more (after a call to
|
|
|
|
:meth:`close` or :meth:`quit` you cannot reopen the connection by issuing
|
|
|
|
another :meth:`login` method).
|
|
|
|
|
2009-11-17 16:21:14 -04:00
|
|
|
|
|
|
|
FTP_TLS Objects
|
|
|
|
---------------
|
|
|
|
|
|
|
|
:class:`FTP_TLS` class inherits from :class:`FTP`, defining these additional objects:
|
|
|
|
|
|
|
|
.. attribute:: FTP_TLS.ssl_version
|
|
|
|
|
|
|
|
The SSL version to use (defaults to *TLSv1*).
|
|
|
|
|
|
|
|
.. method:: FTP_TLS.auth()
|
|
|
|
|
|
|
|
Set up secure control connection by using TLS or SSL, depending on what specified in :meth:`ssl_version` attribute.
|
|
|
|
|
|
|
|
.. method:: FTP_TLS.prot_p()
|
|
|
|
|
|
|
|
Set up secure data connection.
|
|
|
|
|
|
|
|
.. method:: FTP_TLS.prot_c()
|
|
|
|
|
|
|
|
Set up clear text data connection.
|
|
|
|
|
|
|
|
|