1 / 8

FTPLIB

FTPLIB. Dick Steflik CS360. FTPLIB. a Python module to allow the user to transfer files between a user program and an FTP Server. The user should understand the command line version of FTP that comes with the application suite for all common TCP/IP stacks

edward
Télécharger la présentation

FTPLIB

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FTPLIB Dick Steflik CS360

  2. FTPLIB • a Python module to allow the user to transfer files between a user program and an FTP Server. • The user should understand the command line version of FTP that comes with the application suite for all common TCP/IP stacks • See the FTP notes on the CS328 web site at:http://www.binghamton.edu/~steflik/cs328/cs328.htm

  3. Constructors FTP ([host[,user[,passwd[,acct[,timeout]]]]]) returns a new instance of the FTP client class, this is for connecting to unsecure FTP servers. FTP_TLS ([host[,user[,passwd[,acct[, keyfile[,certfile[,timeout]]]]]]]) returns a new instance of the FTP_TLS class, this is for connecting to secure FTP servers.

  4. Methods set_debuglevel – controls the amount of output. (0-none, 1-moderate, 2 0r higher – maximum amount) connect([host[, port[,timeout]]]) - default port is 21, the timeout (unless specified) is the global timeout This method must be done before an other methods can be invoked. getwelcome() - get the remote host’s welcome message. login([user[,passwd[,acct]]]) – user and passwd are strings; can be left as null strings if site is anonymous. Most commands are allowed only after logging in. The acct parameter is seldom used and is optional. abort() – Abort an in progress file transfer. sendcmd(command) – send a command string to the server and return the response. voidcmd (command) – send a simple command to the server and handle the response. retrlines(command[,callback]) Retrieve a file or directory list in ASCII transfer mode. Command should be LIST, NLST. Callback is called for each line (default callback is to print the line to sys.stdout)

  5. Methods (more) set_pasv (boolean) – Enable passive mode (true = on, false = off) storlines(command, file[, callback]) – Store a file in ASCII transfer mode. Lines are read from file until EOF. Callback is call after each line is sent. nlst(argument[,,,,,]) - Return a list of file names in the remote directory.dir(argument[,,,,,,]) – Return a directory list of the remote directory. last argument can be the name of a callback.rename(fromname, toname) – rename the remote file from fromname to toname.delete(filename) – delete filename from the server, is successful returns a normal respone, if unsuccessful raises error_perm or error_reply. cwd(pathname) – set the current directory on the server mkd(dirname) - create a new directory in the server’s current directorypwd() – Return the pathname of the current working directory on the server. rmd(dirname) – remove directory dirname from the server.

  6. Methods (more) size(filename) – Request the size of the file on the server. quit() – Send a QUIT command to the server to close the connection. close() – Unilaterally clost the connection to the server.

More Related