0 ˆÈÌ „Î>×ËÀÉ?÷a ´i¨Šã@sLdZddlZddlZddlmZgd¢ZdZdZdZGdd „d eƒZ Gd d „d e ƒZ Gd d „d e ƒZ Gdd„de ƒZ Gdd„de ƒZ e eefZdZdZGdd„dƒZz ddlZWneyÆdZYn00ejZGdd„deƒZe d¡e eeejfZdadd„Zdadd„Zdd„Zdd„Z d d!„Z!d)d$d%„Z"d&d'„Z#e$d(k�rHe#ƒdS)*aSAn FTP client class and some helper functions. Based on RFC 959: File Transfer Protocol (FTP), by J. Postel and J. Reynolds Example: >>> from ftplib import FTP >>> ftp = FTP('ftp.python.org') # connect to host, default port >>> ftp.login() # default, i.e.: user anonymous, passwd anonymous@ '230 Guest login ok, access restrictions apply.' >>> ftp.retrlines('LIST') # list directory contents 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.' >>> ftp.quit() '221 Goodbye.' >>> A nice test that reveals some of the network dialogue would be: python ftplib.py -d localhost -l -p -l éN)Ú_GLOBAL_DEFAULT_TIMEOUT)ÚFTPÚ error_replyÚ error_tempÚ error_permÚ error_protoÚ all_errorsééé c@s eZdZdS)ÚErrorN©Ú__name__Ú __module__Ú __qualname__©rrú/usr/lib64/python3.9/ftplib.pyr 9ór c@s eZdZdS)rNr rrrrr:rrc@s eZdZdS)rNr rrrrr;rrc@s eZdZdS)rNr rrrrr<rrc@s eZdZdS)rNr rrrrr=rrú s c@sªeZdZdZdZdZeZeZ dZ dZ dZ dZ dZddddedfddœd d „Zd d „Zd d„Zd]dd„Zdd„Zdd„ZeZdd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Z d*d+„Z!d,d-„Z"d.d/„Z#d0d1„Z$d2d3„Z%d^d4d5„Z&d_d6d7„Z'd`d8d9„Z(dad;d<„Z)dbd=d>„Z*dcd?d@„Z+dddAdB„Z,dCdD„Z-dEdF„Z.dGdH„Z/dgfdIdJ„Z0dKdL„Z1dMdN„Z2dOdP„Z3dQdR„Z4dSdT„Z5dUdV„Z6dWdX„Z7dYdZ„Z8d[d\„Z9dS)eruôAn FTP client class. To create a connection, call the class using these arguments: host, user, passwd, acct, timeout, source_address, encoding The first four arguments are all strings, and have default value ''. The parameter ´timeout´ must be numeric and defaults to None if not passed, meaning that no timeout will be set on any ftp socket(s). If a timeout is passed, then this is now the default timeout for all ftp socket operations for this instance. The last parameter is the encoding of filenames, which defaults to utf-8. Then use self.connect() with optional host and port argument. To download a file, use ftp.retrlines('RETR ' + filename), or ftp.retrbinary() with slightly different arguments. To upload a file, use ftp.storlines() or ftp.storbinary(), which have an open file as argument (see their definitions below for details). The download/upload functions first issue appropriate TYPE and PORT or PASV commands. rÚNTFúutf-8©ÚencodingcCs6||_||_||_|r2| |¡|r2| |||¡dS)zãInitialization method (called by class instantiation). Initialize host to localhost, port to standard ftp port. Optional arguments are host (for connect()), and user, passwd, acct (for login()). N)rÚsource_addressÚtimeoutÚconnectÚlogin)ÚselfÚhostÚuserÚpasswdÚacctrr