• Home
  • Raw
  • Download

Lines Matching full:ftp

1 :mod:`!ftplib` --- FTP protocol client
5 :synopsis: FTP protocol client (requires sockets).
10 pair: FTP; protocol
11 single: FTP; ftplib (standard module)
15 This module defines the class :class:`FTP` and a few related items. The
16 :class:`FTP` class implements the client side of the FTP protocol. You can use
17 this to write Python programs that perform a variety of automated FTP jobs, such
18 as mirroring other FTP servers. It is also used by the module
19 :mod:`urllib.request` to handle URLs that use FTP. For more information on FTP
28 >>> from ftplib import FTP
29 >>> ftp = FTP('ftp.us.debian.org') # connect to host, default port
30 >>> ftp.login() # user anonymous, passwd anonymous@
32 >>> ftp.cwd('debian') # change into "debian" directory
34 >>> ftp.retrlines('LIST') # list directory contents
42 >>> ftp.retrbinary('RETR README', fp.write)
44 >>> ftp.quit()
55 FTP objects
72 Account information to be used for the ``ACCT`` FTP command.
84 .. class:: FTP(host='', user='', passwd='', acct='', timeout=None, \
87 Return a new instance of the :class:`FTP` class.
116 The :class:`FTP` class supports the :keyword:`with` statement, e.g.:
118 >>> from ftplib import FTP
119 >>> with FTP("ftp1.at.proftpd.org") as ftp:
120 ... ftp.login()
121 ... ftp.dir()
124 dr-xr-xr-x 9 ftp ftp 154 May 6 10:43 .
125 dr-xr-xr-x 9 ftp ftp 154 May 6 10:43 ..
126 dr-xr-xr-x 5 ftp ftp 4096 May 6 10:43 CentOS
127 dr-xr-xr-x 3 ftp ftp 18 Jul 10 2008 Fedora
142 Several :class:`!FTP` methods are available in two flavors:
147 :class:`FTP` instances have the following methods:
149 .. method:: FTP.set_debuglevel(level)
161 .. method:: FTP.connect(host='', port=0, timeout=None, source_address=None)
166 when the :class:`FTP` instance was created.
167 All other :class:`!FTP` methods can only be called
175 as specified by the FTP protocol specification).
187 .. audit-event:: ftplib.connect self,host,port ftplib.FTP.connect
193 .. method:: FTP.getwelcome()
200 .. method:: FTP.login(user='anonymous', passwd='', acct='')
202 Log on to the connected FTP server.
206 when the :class:`FTP` instance was created.
207 Most FTP commands are only allowed after the client has logged in.
219 .. method:: FTP.abort()
225 .. method:: FTP.sendcmd(cmd)
229 .. audit-event:: ftplib.sendcmd self,cmd ftplib.FTP.sendcmd
232 .. method:: FTP.voidcmd(cmd)
238 .. audit-event:: ftplib.sendcmd self,cmd ftplib.FTP.voidcmd
241 .. method:: FTP.retrbinary(cmd, callback, blocksize=8192, rest=None)
266 .. method:: FTP.retrlines(cmd, callback=None)
279 .. method:: FTP.set_pasv(val)
285 .. method:: FTP.storbinary(cmd, fp, blocksize=8192, callback=None, rest=None)
316 .. method:: FTP.storlines(cmd, fp, callback=None)
325 .. method:: FTP.transfercmd(cmd, rest=None)
344 .. method:: FTP.ntransfercmd(cmd, rest=None)
352 .. method:: FTP.mlsd(path="", facts=[])
366 .. method:: FTP.nlst(argument[, ...])
376 .. method:: FTP.dir(argument[, ...])
388 .. method:: FTP.rename(fromname, toname)
393 .. method:: FTP.delete(filename)
400 .. method:: FTP.cwd(pathname)
405 .. method:: FTP.mkd(pathname)
410 .. method:: FTP.pwd()
415 .. method:: FTP.rmd(dirname)
420 .. method:: FTP.size(filename)
428 .. method:: FTP.quit()
433 :meth:`close` method which renders the :class:`FTP` instance useless for
437 .. method:: FTP.close()
440 closed connection such as after a successful call to :meth:`~FTP.quit`.
441 After this call the :class:`FTP` instance should not be used any more (after
442 a call to :meth:`close` or :meth:`~FTP.quit` you cannot reopen the
452 An :class:`FTP` subclass which adds TLS support to FTP as described in
454 Connect to port 21 implicitly securing the FTP control connection
484 A timeout in seconds for blocking operations like :meth:`~FTP.connect`
516 >>> ftps = FTP_TLS('ftp.pureftpd.org')
524 :class:`!FTP_TLS` class inherits from :class:`FTP`,
544 advantage of firewalls that know how to handle NAT with non-secure FTP
587 The set of all exceptions (as a tuple) that methods of :class:`FTP`
588 instances may raise as a result of problems with the FTP connection (as
597 typically used by FTP clients to load user authentication information