/opt/alt/python34/lib64/python3.4/__pycache__
NameSizeModeActions
abc.cpython-34.pyc78770644editdlrm
abc.cpython-34.pyo78270644editdlrm
aifc.cpython-34.pyc279120644editdlrm
aifc.cpython-34.pyo279120644editdlrm
antigravity.cpython-34.pyc8470644editdlrm
antigravity.cpython-34.pyo8470644editdlrm
argparse.cpython-34.pyc658740644editdlrm
argparse.cpython-34.pyo657150644editdlrm
ast.cpython-34.pyc123600644editdlrm
ast.cpython-34.pyo123600644editdlrm
asynchat.cpython-34.pyc83590644editdlrm
asynchat.cpython-34.pyo83590644editdlrm
asyncore.cpython-34.pyc179630644editdlrm
asyncore.cpython-34.pyo179630644editdlrm
base64.cpython-34.pyc182970644editdlrm
base64.cpython-34.pyo180990644editdlrm
bdb.cpython-34.pyc186940644editdlrm
bdb.cpython-34.pyo186940644editdlrm
binhex.cpython-34.pyc135410644editdlrm
binhex.cpython-34.pyo135410644editdlrm
bisect.cpython-34.pyc28580644editdlrm
bisect.cpython-34.pyo28580644editdlrm
bz2.cpython-34.pyc151560644editdlrm
bz2.cpython-34.pyo151560644editdlrm
calendar.cpython-34.pyc275670644editdlrm
calendar.cpython-34.pyo275670644editdlrm
cgi.cpython-34.pyc298270644editdlrm
cgi.cpython-34.pyo298270644editdlrm
cgitb.cpython-34.pyc110640644editdlrm
cgitb.cpython-34.pyo110640644editdlrm
chunk.cpython-34.pyc52700644editdlrm
chunk.cpython-34.pyo52700644editdlrm
cmd.cpython-34.pyc134560644editdlrm
cmd.cpython-34.pyo134560644editdlrm
code.cpython-34.pyc97020644editdlrm
code.cpython-34.pyo97020644editdlrm
codecs.cpython-34.pyc351320644editdlrm
codecs.cpython-34.pyo351320644editdlrm
codeop.cpython-34.pyc64660644editdlrm
codeop.cpython-34.pyo64660644editdlrm
colorsys.cpython-34.pyc36590644editdlrm
colorsys.cpython-34.pyo36590644editdlrm
compileall.cpython-34.pyc73780644editdlrm
compileall.cpython-34.pyo73780644editdlrm
configparser.cpython-34.pyc448820644editdlrm
configparser.cpython-34.pyo448820644editdlrm
contextlib.cpython-34.pyc103700644editdlrm
contextlib.cpython-34.pyo103700644editdlrm
copy.cpython-34.pyc80610644editdlrm
copy.cpython-34.pyo79750644editdlrm
copyreg.cpython-34.pyc46070644editdlrm
copyreg.cpython-34.pyo45660644editdlrm
cProfile.cpython-34.pyc46220644editdlrm
cProfile.cpython-34.pyo46220644editdlrm
crypt.cpython-34.pyc24370644editdlrm
crypt.cpython-34.pyo24370644editdlrm
csv.cpython-34.pyc129970644editdlrm
csv.cpython-34.pyo129970644editdlrm
datetime.cpython-34.pyc562640644editdlrm
datetime.cpython-34.pyo542960644editdlrm
decimal.cpython-34.pyc1725260644editdlrm
decimal.cpython-34.pyo1725260644editdlrm
difflib.cpython-34.pyc605150644editdlrm
difflib.cpython-34.pyo604670644editdlrm
dis.cpython-34.pyc145870644editdlrm
dis.cpython-34.pyo145870644editdlrm
doctest.cpython-34.pyc801100644editdlrm
doctest.cpython-34.pyo798370644editdlrm
dummy_threading.cpython-34.pyc12140644editdlrm
dummy_threading.cpython-34.pyo12140644editdlrm
enum.cpython-34.pyc163390644editdlrm
enum.cpython-34.pyo163390644editdlrm
filecmp.cpython-34.pyc91200644editdlrm
filecmp.cpython-34.pyo91200644editdlrm
fileinput.cpython-34.pyc142970644editdlrm
fileinput.cpython-34.pyo142970644editdlrm
fnmatch.cpython-34.pyc31460644editdlrm
fnmatch.cpython-34.pyo31460644editdlrm
formatter.cpython-34.pyc189160644editdlrm
formatter.cpython-34.pyo189160644editdlrm
fractions.cpython-34.pyc192700644editdlrm
fractions.cpython-34.pyo192700644editdlrm
ftplib.cpython-34.pyc333220644editdlrm
ftplib.cpython-34.pyo333220644editdlrm
functools.cpython-34.pyc236140644editdlrm
functools.cpython-34.pyo236140644editdlrm
genericpath.cpython-34.pyc34930644editdlrm
genericpath.cpython-34.pyo34930644editdlrm
getopt.cpython-34.pyc67330644editdlrm
getopt.cpython-34.pyo66910644editdlrm
getpass.cpython-34.pyc46240644editdlrm
getpass.cpython-34.pyo46240644editdlrm
gettext.cpython-34.pyc151740644editdlrm
gettext.cpython-34.pyo151740644editdlrm
glob.cpython-34.pyc28800644editdlrm
glob.cpython-34.pyo28800644editdlrm
gzip.cpython-34.pyc194460644editdlrm
gzip.cpython-34.pyo193920644editdlrm
hashlib.cpython-34.pyc79440644editdlrm
hashlib.cpython-34.pyo79440644editdlrm
heapq.cpython-34.pyc139100644editdlrm
heapq.cpython-34.pyo139100644editdlrm
hmac.cpython-34.pyc51460644editdlrm
hmac.cpython-34.pyo51460644editdlrm
imaplib.cpython-34.pyc434790644editdlrm
imaplib.cpython-34.pyo409550644editdlrm
imghdr.cpython-34.pyc41430644editdlrm
imghdr.cpython-34.pyo41430644editdlrm
imp.cpython-34.pyc98670644editdlrm
imp.cpython-34.pyo98670644editdlrm
inspect.cpython-34.pyc763270644editdlrm
inspect.cpython-34.pyo760060644editdlrm
io.cpython-34.pyc34580644editdlrm
io.cpython-34.pyo34580644editdlrm
ipaddress.cpython-34.pyc629840644editdlrm
ipaddress.cpython-34.pyo629840644editdlrm
keyword.cpython-34.pyc19460644editdlrm
keyword.cpython-34.pyo19460644editdlrm
linecache.cpython-34.pyc31120644editdlrm
linecache.cpython-34.pyo31120644editdlrm
locale.cpython-34.pyc372760644editdlrm
locale.cpython-34.pyo372760644editdlrm
lzma.cpython-34.pyc159170644editdlrm
lzma.cpython-34.pyo159170644editdlrm
macpath.cpython-34.pyc60060644editdlrm
macpath.cpython-34.pyo60060644editdlrm
macurl2path.cpython-34.pyc21020644editdlrm
macurl2path.cpython-34.pyo21020644editdlrm
mailbox.cpython-34.pyc702880644editdlrm
mailbox.cpython-34.pyo701890644editdlrm
mailcap.cpython-34.pyc65440644editdlrm
mailcap.cpython-34.pyo65440644editdlrm
mimetypes.cpython-34.pyc168070644editdlrm
mimetypes.cpython-34.pyo168070644editdlrm
modulefinder.cpython-34.pyc173760644editdlrm
modulefinder.cpython-34.pyo172970644editdlrm
netrc.cpython-34.pyc42770644editdlrm
netrc.cpython-34.pyo42770644editdlrm
nntplib.cpython-34.pyc363100644editdlrm
nntplib.cpython-34.pyo363100644editdlrm
ntpath.cpython-34.pyc133050644editdlrm
ntpath.cpython-34.pyo133050644editdlrm
nturl2path.cpython-34.pyc17160644editdlrm
nturl2path.cpython-34.pyo17160644editdlrm
numbers.cpython-34.pyc126670644editdlrm
numbers.cpython-34.pyo126670644editdlrm
opcode.cpython-34.pyc51740644editdlrm
opcode.cpython-34.pyo51740644editdlrm
operator.cpython-34.pyc127780644editdlrm
operator.cpython-34.pyo127780644editdlrm
optparse.cpython-34.pyc515370644editdlrm
optparse.cpython-34.pyo514600644editdlrm
os.cpython-34.pyc295990644editdlrm
os.cpython-34.pyo295990644editdlrm
pathlib.cpython-34.pyc404830644editdlrm
pathlib.cpython-34.pyo404830644editdlrm
pdb.cpython-34.pyc494720644editdlrm
pdb.cpython-34.pyo494060644editdlrm
pickle.cpython-34.pyc469840644editdlrm
pickle.cpython-34.pyo468380644editdlrm
pickletools.cpython-34.pyc702540644editdlrm
pickletools.cpython-34.pyo691670644editdlrm
pipes.cpython-34.pyc84310644editdlrm
pipes.cpython-34.pyo84310644editdlrm
pkgutil.cpython-34.pyc176000644editdlrm
pkgutil.cpython-34.pyo176000644editdlrm
platform.cpython-34.pyc311720644editdlrm
platform.cpython-34.pyo311720644editdlrm
plistlib.cpython-34.pyc301510644editdlrm
plistlib.cpython-34.pyo300680644editdlrm
poplib.cpython-34.pyc137540644editdlrm
poplib.cpython-34.pyo137540644editdlrm
posixpath.cpython-34.pyc98090644editdlrm
posixpath.cpython-34.pyo98090644editdlrm
pprint.cpython-34.pyc114600644editdlrm
pprint.cpython-34.pyo112950644editdlrm
profile.cpython-34.pyc151510644editdlrm
profile.cpython-34.pyo148980644editdlrm
pstats.cpython-34.pyc236750644editdlrm
pstats.cpython-34.pyo236750644editdlrm
pty.cpython-34.pyc42250644editdlrm
pty.cpython-34.pyo42250644editdlrm
pyclbr.cpython-34.pyc91920644editdlrm
pyclbr.cpython-34.pyo91920644editdlrm
pydoc.cpython-34.pyc909150644editdlrm
pydoc.cpython-34.pyo908540644editdlrm
py_compile.cpython-34.pyc68570644editdlrm
py_compile.cpython-34.pyo68570644editdlrm
queue.cpython-34.pyc92620644editdlrm
queue.cpython-34.pyo92620644editdlrm
quopri.cpython-34.pyc64460644editdlrm
quopri.cpython-34.pyo62360644editdlrm
random.cpython-34.pyc190590644editdlrm
random.cpython-34.pyo190590644editdlrm
re.cpython-34.pyc145500644editdlrm
re.cpython-34.pyo145500644editdlrm
reprlib.cpython-34.pyc58720644editdlrm
reprlib.cpython-34.pyo58720644editdlrm
rlcompleter.cpython-34.pyc56950644editdlrm
rlcompleter.cpython-34.pyo56950644editdlrm
runpy.cpython-34.pyc77530644editdlrm
runpy.cpython-34.pyo77530644editdlrm
sched.cpython-34.pyc65730644editdlrm
sched.cpython-34.pyo65730644editdlrm
selectors.cpython-34.pyc167440644editdlrm
selectors.cpython-34.pyo167440644editdlrm
shelve.cpython-34.pyc99550644editdlrm
shelve.cpython-34.pyo99550644editdlrm
shlex.cpython-34.pyc75180644editdlrm
shlex.cpython-34.pyo75180644editdlrm
shutil.cpython-34.pyc330150644editdlrm
shutil.cpython-34.pyo330150644editdlrm
site.cpython-34.pyc179710644editdlrm
site.cpython-34.pyo179710644editdlrm
smtpd.cpython-34.pyc256690644editdlrm
smtpd.cpython-34.pyo256690644editdlrm
smtplib.cpython-34.pyc331290644editdlrm
smtplib.cpython-34.pyo330550644editdlrm
sndhdr.cpython-34.pyc67690644editdlrm
sndhdr.cpython-34.pyo67690644editdlrm
socket.cpython-34.pyc181110644editdlrm
socket.cpython-34.pyo180610644editdlrm
socketserver.cpython-34.pyc232550644editdlrm
socketserver.cpython-34.pyo232550644editdlrm
sre_compile.cpython-34.pyc119350644editdlrm
sre_compile.cpython-34.pyo117780644editdlrm
sre_constants.cpython-34.pyc55810644editdlrm
sre_constants.cpython-34.pyo55810644editdlrm
sre_parse.cpython-34.pyc202380644editdlrm
sre_parse.cpython-34.pyo202380644editdlrm
ssl.cpython-34.pyc276080644editdlrm
ssl.cpython-34.pyo276080644editdlrm
stat.cpython-34.pyc35780644editdlrm
stat.cpython-34.pyo35780644editdlrm
statistics.cpython-34.pyc171580644editdlrm
statistics.cpython-34.pyo168560644editdlrm
string.cpython-34.pyc83760644editdlrm
string.cpython-34.pyo83760644editdlrm
stringprep.cpython-34.pyc136360644editdlrm
stringprep.cpython-34.pyo135730644editdlrm
struct.cpython-34.pyc3470644editdlrm
struct.cpython-34.pyo3470644editdlrm
subprocess.cpython-34.pyc433590644editdlrm
subprocess.cpython-34.pyo432460644editdlrm
sunau.cpython-34.pyc183090644editdlrm
sunau.cpython-34.pyo183090644editdlrm
symbol.cpython-34.pyc26620644editdlrm
symbol.cpython-34.pyo26620644editdlrm
symtable.cpython-34.pyc113050644editdlrm
symtable.cpython-34.pyo111830644editdlrm
sysconfig.cpython-34.pyc172870644editdlrm
sysconfig.cpython-34.pyo172870644editdlrm
tabnanny.cpython-34.pyc77490644editdlrm
tabnanny.cpython-34.pyo77490644editdlrm
tarfile.cpython-34.pyc680400644editdlrm
tarfile.cpython-34.pyo680400644editdlrm
telnetlib.cpython-34.pyc193940644editdlrm
telnetlib.cpython-34.pyo193940644editdlrm
tempfile.cpython-34.pyc215760644editdlrm
tempfile.cpython-34.pyo215760644editdlrm
textwrap.cpython-34.pyc138000644editdlrm
textwrap.cpython-34.pyo137140644editdlrm
this.cpython-34.pyc13160644editdlrm
this.cpython-34.pyo13160644editdlrm
threading.cpython-34.pyc389650644editdlrm
threading.cpython-34.pyo382520644editdlrm
timeit.cpython-34.pyc110620644editdlrm
timeit.cpython-34.pyo110620644editdlrm
token.cpython-34.pyc36150644editdlrm
token.cpython-34.pyo36150644editdlrm
tokenize.cpython-34.pyc199510644editdlrm
tokenize.cpython-34.pyo199010644editdlrm
trace.cpython-34.pyc241840644editdlrm
trace.cpython-34.pyo241270644editdlrm
traceback.cpython-34.pyc110910644editdlrm
traceback.cpython-34.pyo110910644editdlrm
tracemalloc.cpython-34.pyc171300644editdlrm
tracemalloc.cpython-34.pyo171300644editdlrm
tty.cpython-34.pyc11460644editdlrm
tty.cpython-34.pyo11460644editdlrm
types.cpython-34.pyc55600644editdlrm
types.cpython-34.pyo55600644editdlrm
uu.cpython-34.pyc40210644editdlrm
uu.cpython-34.pyo40210644editdlrm
uuid.cpython-34.pyc218640644editdlrm
uuid.cpython-34.pyo218020644editdlrm
warnings.cpython-34.pyc122680644editdlrm
warnings.cpython-34.pyo115360644editdlrm
wave.cpython-34.pyc191350644editdlrm
wave.cpython-34.pyo190740644editdlrm
weakref.cpython-34.pyc203450644editdlrm
weakref.cpython-34.pyo203080644editdlrm
webbrowser.cpython-34.pyc171320644editdlrm
webbrowser.cpython-34.pyo170930644editdlrm
xdrlib.cpython-34.pyc90020644editdlrm
xdrlib.cpython-34.pyo90020644editdlrm
zipfile.cpython-34.pyc458200644editdlrm
zipfile.cpython-34.pyo457710644editdlrm
_bootlocale.cpython-34.pyc10470644editdlrm
_bootlocale.cpython-34.pyo10160644editdlrm
_collections_abc.cpython-34.pyc239490644editdlrm
_collections_abc.cpython-34.pyo239490644editdlrm
_compat_pickle.cpython-34.pyc75010644editdlrm
_compat_pickle.cpython-34.pyo74270644editdlrm
_dummy_thread.cpython-34.pyc48250644editdlrm
_dummy_thread.cpython-34.pyo48250644editdlrm
_markupbase.cpython-34.pyc89320644editdlrm
_markupbase.cpython-34.pyo87450644editdlrm
_osx_support.cpython-34.pyc106300644editdlrm
_osx_support.cpython-34.pyo106300644editdlrm
_pyio.cpython-34.pyc649330644editdlrm
_pyio.cpython-34.pyo649070644editdlrm
_sitebuiltins.cpython-34.pyc36770644editdlrm
_sitebuiltins.cpython-34.pyo36770644editdlrm
_strptime.cpython-34.pyc157790644editdlrm
_strptime.cpython-34.pyo157790644editdlrm
_sysconfigdata.cpython-34.pyc227000644editdlrm
_sysconfigdata.cpython-34.pyo227000644editdlrm
_threading_local.cpython-34.pyc69460644editdlrm
_threading_local.cpython-34.pyo69460644editdlrm
_weakrefset.cpython-34.pyc84650644editdlrm
_weakrefset.cpython-34.pyo84650644editdlrm
__future__.cpython-34.pyc41680644editdlrm
__future__.cpython-34.pyo41680644editdlrm
__phello__.foo.cpython-34.pyc1340644editdlrm
__phello__.foo.cpython-34.pyo1340644editdlrm
Edit: /opt/alt/python34/lib64/python3.4/__pycache__/ftplib.cpython-34.pyc (33322B)
f @sdZddlZddlZddlZddlZddlmZddgZdZdZdZ Gd d d e Z Gd d d e Z Gd dde Z Gddde ZGddde Ze eefZdZdZGdddZyddlZWnek r*dZYnBXejZGdddeZejde eeejfZdaddZdaddZ ddZ!ddZ"d d!Z#d"d#d$d%Z$Gd&ddZ%d'd(Z&e'd)kre&ndS)*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_TIMEOUTFTPNetrci c@seZdZdS)ErrorN)__name__ __module__ __qualname__r r +/opt/alt/python34/lib64/python3.4/ftplib.pyr:s rc@seZdZdS) error_replyN)rr r r r r r r ;s r c@seZdZdS) error_tempN)rr r r r r r r<s rc@seZdZdS) error_permN)rr r r r r r r=s rc@seZdZdS) error_protoN)rr r r r r r r>s rz s c@seZdZdZdZdZeZeZ dZ dZ dZ dZ dZddddedddZd d Zd d Zddd[dddZddZddZeZddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Z d(d)Z!d*d+Z"d,d-Z#d.d/Z$d0d1Z%dd2d3Z&dd4d5Z'dddd6d7Z(d8dd9d:Z)dd;d<Z*d8ddd=d>Z+dd?d@Z,dAdBZ-dCdDZ.dEdFZ/dgdGdHZ0dIdJZ1dKdLZ2dMdNZ3dOdPZ4dQdRZ5dSdTZ6dUdVZ7dWdXZ8dYdZZ9dS)\rayAn FTP client class. To create a connection, call the class using these arguments: host, user, passwd, acct, timeout The first four arguments are all strings, and have default value ''. 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. 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. rNrzlatin-1cCsH||_||_|rD|j||rD|j|||qDndS)N)source_addresstimeoutconnectlogin)selfhostuserpasswdacctrrr r r __init__qs    z FTP.__init__cCs|S)Nr )rr r r __enter__zsz FTP.__enter__cGsc|jdk r_z-y|jWnttfk r:YnXWd|jdk r[|jnXndS)N)sockquitOSErrorEOFErrorclose)rargsr r r __exit__~s z FTP.__exit__icCs|dkr||_n|dkr0||_n|dkrH||_n|dk r`||_ntj|j|jf|jd|j|_|jj|_|jj dd|j |_ |j |_ |j S) awConnect to host. Arguments are: - host: hostname to connect to (string, default previous host) - port: port to connect to (integer, default previous port) - timeout: the timeout to set against the ftp socket(s) - source_address: a 2-tuple (host, port) for the socket to bind to as its source address before connecting. rriNrrencodingi)rportrrsocketcreate_connectionrZfamilyafmakefiler%filegetrespwelcome)rrr&rrr r r rs        z FTP.connectcCs,|jr%td|j|jn|jS)z`Get the welcome message from the server. (this is read and squirreled away by connect())z *welcome*) debuggingprintsanitizer-)rr r r getwelcomes zFTP.getwelcomecCs ||_dS)zSet the debugging level. The required argument level means: 0: no debugging output (default) 1: print commands and responses but not body text etc. 2: also print raw lines read and sent before stripping CR/LFN)r.)rlevelr r r set_debuglevelszFTP.set_debuglevelcCs ||_dS)zUse passive or active mode for data transfers. With a false argument, use the normal PORT mode, With a true argument, use the PASV command.N) passiveserver)rvalr r r set_pasvsz FTP.set_pasvcCsb|dddkrXt|jd}|ddd|d||d}nt|S)Npass PASS z *>r9r8)lenrstriprepr)rsir r r r0s-z FTP.sanitizecCsyd|ksd|kr'tdn|t}|jdkrYtd|j|n|jj|j|jdS)N  z4an illegal newline character should not be containedrz*put*) ValueErrorCRLFr.r/r0rsendallencoder%)rliner r r putlines  z FTP.putlinecCs3|jr"td|j|n|j|dS)Nz*cmd*)r.r/r0rG)rrFr r r putcmds z FTP.putcmdcCs|jj|jd}t||jkrDtd|jn|jdkrltd|j|n|s{tn|ddt kr|dd}n)|ddt kr|dd}n|S) Nrzgot more than %d bytesz*get*rJrK) r+readlinemaxliner;rr.r/r0r rC)rrFr r r getlines z FTP.getlinecCs|j}|dddkr|dd}xQ|j}|d|}|dd|kr5|dddkr5Pq5q5Wn|S)N-rA)rN)rrFcodeZnextliner r r getmultilines   zFTP.getmultilinecCs|j}|jr.td|j|n|dd|_|dd}|d kra|S|dkr|t|n|dkrt|nt|dS) Nz*resp*rOr12345>rTrVrU)rSr.r/r0Zlastresprrr)rrespcr r r r,s     z FTP.getrespcCs5|j}|dddkr1t|n|S)z%Expect a response beginning with '2'.NrrU)r,r )rrYr r r voidresps z FTP.voidrespcCszdt}|jdkr2td|j|n|jj|t|j}|ddd krvt|n|S) zAbort a file transfer. Uses out-of-band data. This does not follow the procedure from the RFC to send Telnet IP and Synch; that doesn't seem to work with the servers I've tried. Instead, just send the ABOR command as OOB data.sABORrz *put urgent*NrO426225226>r]r\r^) B_CRLFr.r/r0rrDMSG_OOBrSr)rrFrYr r r aborts  z FTP.abortcCs|j||jS)z'Send a command and return the response.)rHr,)rcmdr r r sendcmds z FTP.sendcmdcCs|j||jS)z8Send a command and expect a response beginning with '2'.)rHr[)rrbr r r voidcmds z FTP.voidcmdcCsY|jd}t|dt|dg}||}ddj|}|j|S)zUSend a PORT command with the current host and the given port number. .zPORT ,)splitr=joinrd)rrr&ZhbytesZpbytesbytesrbr r r sendports   z FTP.sendportcCsd}|jtjkr!d}n|jtjkr<d}n|dkrWtdndt||t|dg}ddj|}|j|S)zESend an EPRT command with the current host and the given port number.rrrIzunsupported address familyrzEPRT |)r)r'AF_INETZAF_INET6rr=rird)rrr&r)Zfieldsrbr r r sendeprt#s   !z FTP.sendeprtc Csd}d}xtjdd|jtjdtjD]}|\}}}}}y&tj|||}|j|WnGtk r} z'| }|r|jnd}w4WYdd} ~ XnXPq4W|dkr|dk r|qtdn|jd|j d} |j j d} |jtj krK|j | | } n|j | | } |jtk r|j|jn|S)z3Create a new socket and send a PORT command for it.Nrz!getaddrinfo returns an empty listr)r'Z getaddrinfor)Z SOCK_STREAMZ AI_PASSIVEZbindrr!ZlistenZ getsocknamerrmrkrnrr settimeout) rerrrresr)ZsocktypeprotoZ canonnameZsa_r&rrYr r r makeport0s6.     z FTP.makeportcCsa|jtjkr0t|jd\}}n't|jd|jj\}}||fS)NPASVZEPSV)r)r'rmparse227rcparse229rZ getpeername)rrr&r r r makepasvPs'z FTP.makepasvc Csd}|jr|j\}}tj||f|jd|j}yq|dk rh|jd|n|j|}|ddkr|j}n|ddkrt|nWq|j YqXn|j }|dk r|jd|n|j|}|ddkr.|j}n|ddkrMt|n|j \}} |jt k r|j |jnWdQX|dddkrt|}n||fS) aInitiate a transfer over the data connection. If the transfer is active, send a port command and the transfer command, and accept the connection. If the server is passive, send a pasv command, connect to it, and start the transfer command. Either way, return the socket for the connection and the expected size of the transfer. The expected size may be None if it could not be determined. Optional `rest' argument can be a string that is sent as the argument to a REST command. This is essentially a server marker used to tell the server to skip over any data up to the given marker. NrzREST %srrUrTrO150)r4rxr'r(rrrcr,r r!rtZacceptrroparse150) rrbrestsizerr&connrYrZsockaddrr r r ntransfercmdWs<      zFTP.ntransfercmdcCs|j||dS)z0Like ntransfercmd() but returns only the socket.r)r~)rrbr{r r r transfercmdszFTP.transfercmdcCs|sd}n|sd}n|s-d}n|dkrR|d krR|d}n|jd|}|ddkr|jd|}n|ddkr|jd |}n|dd krt|n|S) zLogin, default anonymous.Z anonymousrrQz anonymous@zUSER rrVzPASS zACCT rU>rrQ)rcr )rrrrrYr r r rs     z FTP.logini c Cs|jd|j||Y}x'|j|}|s>Pn||q%Wtdk rtt|trt|jnWdQX|jS)aRetrieve data in binary mode. A new port is created for you. Args: cmd: A RETR command. callback: A single parameter callable to be called on each block of data read. blocksize: The maximum number of bytes to read from the socket at one time. [default: 8192] rest: Passed to transfercmd(). [default: None] Returns: The response code. zTYPE IN)rdrZrecv _SSLSocket isinstanceunwrapr[)rrbcallback blocksizer{r}datar r r retrbinarys zFTP.retrbinarycCsb|dkrt}n|jd}|j|#}|jdd|j}x|j|jd}t||jkrtd|jn|j dkrt dt |n|sPn|d dt kr|dd }n)|d dd kr|dd }n||qTWt dk rLt|t rL|jnWdQXWdQX|jS)ahRetrieve data in line mode. A new port is created for you. Args: cmd: A RETR, LIST, or NLST command. callback: An optional single parameter callable that is called for each line with the trailing CRLF stripped. [default: print_line()] Returns: The response code. NzTYPE Ar$r%rzgot more than %d bytesrIz*retr*rArJrJrKrK) print_linercrr*r%rLrMr;rr.r/r=rCrrrr[)rrbrrYr}fprFr r r retrliness*  z FTP.retrlinesc Cs|jd|j||o}x=|j|}|s>Pn|j||r%||q%q%Wtdk rt|tr|jnWdQX|jS)a9Store a file in binary mode. A new port is created for you. Args: cmd: A STOR command. fp: A file-like object with a read(num_bytes) method. blocksize: The maximum data size to read from fp and send over the connection at once. [default: 8192] callback: An optional single parameter callable that is called on each block of data after it is sent. [default: None] rest: Passed to transfercmd(). [default: None] Returns: The response code. zTYPE IN)rdrreadrDrrrr[)rrbrrrr{r}bufr r r storbinarys  zFTP.storbinaryc Cs|jd|j|}x|j|jd}t||jkrctd|jn|smPn|ddtkr|dtkr|dd}n|t}n|j||r"||q"q"Wtdk rt |tr|j nWdQX|j S) ahStore a file in line mode. A new port is created for you. Args: cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on each line after it is sent. [default: None] Returns: The response code. zTYPE Arzgot more than %d bytesrINrJrKrK) rdrrLrMr;rr_rDrrrr[)rrbrrr}rr r r storliness$   z FTP.storlinescCsd|}|j|S)zSend new account name.zACCT )rd)rpasswordrbr r r r%s zFTP.acctcGsBd}x|D]}|d|}q Wg}|j||j|S)zBReturn a list of files in a given directory (default the current).ZNLST )rappend)rr"rbargfilesr r r nlst*s  zFTP.nlstcGsd}d}|ddrVt|dtdkrV|dd|d }}nx%|D]}|r]|d|}q]q]W|j||dS) aList a directory in long form. By default list current directory to stdout. Optional last argument is callback function; all non-empty arguments before it are concatenated to the LIST command. (This *should* only be used for a pathname.)ZLISTNrrrrKrKrKrK)typer)rr"rbfuncrr r r dir3s, zFTP.dirc cs|r'|jddj|dn|r:d|}nd}g}|j||jx|D]}|jtjd\}}}i} xI|dd jdD].} | jd\} }} | | | jrr)rcr )rfilenamerYr r r deleteesz FTP.deletecCs|dkrky|jdSWqtk rg}z(|jddddkrUnWYdd}~XqXn|dkrd}nd |}|j|S) zChange to a directory.z..ZCDUPrNrO500rrezCWD )rdrr")rdirnamemsgrbr r r cwdms    zFTP.cwdcCsM|jd|}|dddkrI|ddj}t|SdS)zRetrieve the size of a file.zSIZE NrOZ213)rcstripint)rrrYr>r r r r|zszFTP.sizecCs0|jd|}|jds&dSt|S)z+Make a directory, return its full pathname.zMKD 257r)rd startswithparse257)rrrYr r r mkdszFTP.mkdcCs|jd|S)zRemove a directory.zRMD )rd)rrr r r rmdszFTP.rmdcCs,|jd}|jds"dSt|S)z!Return current working directory.ZPWDrr)rdrr)rrYr r r pwdszFTP.pwdcCs|jd}|j|S)zQuit, and close the connection.ZQUIT)rdr!)rrYr r r rs zFTP.quitc Csbz/|j}d|_|dk r.|jnWd|j}d|_|dk r]|jnXdS)z8Close the connection without assuming anything about it.N)r+r!r)rr+rr r r r!s      z FTP.closei):rr r __doc__r.rFTP_PORTr&MAXLINErMrr+r-r4r%rrrr#rr1r3debugr6r0rGrHrNrSr,r[rarcrdrkrnrtrxr~rrrrrrrrrrrrrr|rrrrr!r r r r rKsj                 7#       c @seZdZdZejZdddddddeddd ZddddddZ d d Z d d Z d dZ ddZ dddZddZdS)FTP_TLSaA 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 before authenticating. Securing the data connection requires user to explicitly ask for it by calling prot_p() method. Usage example: >>> from ftplib import FTP_TLS >>> ftps = FTP_TLS('ftp.python.org') >>> ftps.login() # login anonymously previously securing control channel '230 Guest login ok, access restrictions apply.' >>> ftps.prot_p() # switch to secure data connection '200 Protection level set to P' >>> ftps.retrlines('LIST') # list directory content securely 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() '221 Goodbye.' >>> rNc Cs|dk r'|dk r'tdn|dk rN|dk rNtdn||_||_|dkrtj|jd|d|}n||_d|_tj ||||||| dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusivecertfilekeyfileF) rBrrsslZ_create_stdlib_context ssl_versioncontext_prot_prr) rrrrrrrrrrr r r rs      zFTP_TLS.__init__TcCs?|r)t|jtj r)|jntj||||S)N)rrr SSLSocketauthrr)rrrrZsecurer r r rs z FTP_TLS.logincCst|jtjr$tdn|jtjkrH|jd}n|jd}|jj |jd|j |_|jj ddd|j |_ |S)z2Set up secure control connection by using TLS/SSL.zAlready using TLSzAUTH TLSzAUTH SSLserver_hostnamemoder$r%)rrrrrBrPROTOCOL_SSLv23rdr wrap_socketrr*r%r+)rrYr r r rs!z FTP_TLS.authcCsIt|jtjs$tdn|jd}|jj|_|S)z/Switch back to a clear-text control connection.z not using TLSZCCC)rrrrrBrdr)rrYr r r cccs z FTP_TLS.ccccCs)|jd|jd}d|_|S)zSet up secure data connection.zPBSZ 0zPROT PT)rdr)rrYr r r prot_ps  zFTP_TLS.prot_pcCs|jd}d|_|S)z"Set up clear text data connection.zPROT CF)rdr)rrYr r r prot_cs zFTP_TLS.prot_ccCsLtj|||\}}|jrB|jj|d|j}n||fS)Nr)rr~rrrr)rrbr{r}r|r r r r~s  zFTP_TLS.ntransfercmdcCsOdt}|jj||j}|dddkrKt|n|S)NsABORrOr\r]r^>225426226)r_rrDrSr)rrFrYr r r ra!s   z FTP_TLS.abort)rr r rrrrrrrrrrrr~rar r r r rs     rcCs|dddkr%t|ntdkr\ddl}|jd|j|jBantj|}|sudSt|jdS)zParse the '150' response for a RETR request. Returns the expected transfer size or None; size is not guaranteed to be present in the 150 message. NrOryrz150 .* \((\d+) bytes\)r) r _150_rerecompile IGNORECASEASCIImatchrgroup)rYrmr r r rz0s  rzcCs|dddkr%t|ntdkrUddl}|jd|jantj|}|syt|n|j}dj|dd}t |dd>t |d }||fS) zParse the '227' response for a PASV request. Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)' Return ('host.addr.as.numbers', port#) tuple.NrOZ227rz#(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)rerPr7) r _227_rerrrsearchrgroupsrir)rYrrZnumbersrr&r r r rvDs   "rvcCs|dddkr%t|n|jd}|dkrOt|n|jd|d}|dkrt|n||d||dkrt|n||d|j||d}t|dkrt|n|d}t|d}||fS) zParse the '229' response for an EPSV request. Raises error_proto if it does not contain '(|||port|)' Return ('host.addr.as.numbers', port#) tuple.NrOZ229(r)rr7)r findrrhr;r)rYZpeerleftrightpartsrr&r r r rwXs   % rwcCs|dddkr%t|n|dddkr?dSd}d}t|}xg||kr||}|d}|dkr||ks||dkrPn|d}n||}qZW|S) zParse the '257' response for a MKD or PWD request. This is a response to a MKD or PWD request: a directory name. Returns the directoryname in the 257 reply.NrOrr7z "rr")r r;)rYrr?nrZr r r rns      rcCst|dS)z+Default retrlines callback to print a line.N)r/)rFr r r rsrrIc Cs|s|}nd|}|j||j|t|jd\}}|j|||jd|}|ddd krtn|jd|}|ddd krtn|j|jdS) z+Copy file from one FTP-instance to another.zTYPE ruzSTOR NrO125ryzRETR >r150>rr)rdrvrcrkrr[) sourceZ sourcenametargetZ targetnamerZ sourcehostZ sourceportZtreplyZsreplyr r r ftpcps       rc@sgeZdZdZdZdZdZdddZddZddZ d d Z d d Z dS) rzClass to parse & provide access to 'netrc' format files. See the netrc(4) man page for information on the file format. WARNING: This class is obsolete -- use module netrc instead. NcCstjdtd|dkr\dtjkrMtjjtjdd}q\tdni|_i|_ t |d}d}xf|j }|sPn|r|j r|j |qn"|rt||j |sP     b   x      m 7