golden hour
/usr/lib64/python2.7
⬆️ Go Up
Upload
File/Folder
Size
Actions
BaseHTTPServer.py
21.93 KB
Del
OK
BaseHTTPServer.pyc
21.18 KB
Del
OK
BaseHTTPServer.pyo
21.18 KB
Del
OK
Bastion.py
5.61 KB
Del
OK
Bastion.pyc
6.5 KB
Del
OK
Bastion.pyo
6.5 KB
Del
OK
CGIHTTPServer.py
12.84 KB
Del
OK
CGIHTTPServer.pyc
10.84 KB
Del
OK
CGIHTTPServer.pyo
10.84 KB
Del
OK
ConfigParser.py
27.1 KB
Del
OK
ConfigParser.pyc
24.62 KB
Del
OK
ConfigParser.pyo
24.62 KB
Del
OK
Cookie.py
24.66 KB
Del
OK
Cookie.pyc
21.64 KB
Del
OK
Cookie.pyo
21.64 KB
Del
OK
Demo
-
Del
OK
Doc
-
Del
OK
DocXMLRPCServer.py
10.52 KB
Del
OK
DocXMLRPCServer.pyc
9.96 KB
Del
OK
DocXMLRPCServer.pyo
9.85 KB
Del
OK
HTMLParser.py
16.58 KB
Del
OK
HTMLParser.pyc
13.39 KB
Del
OK
HTMLParser.pyo
13.1 KB
Del
OK
MimeWriter.py
6.33 KB
Del
OK
MimeWriter.pyc
7.19 KB
Del
OK
MimeWriter.pyo
7.19 KB
Del
OK
Queue.py
8.36 KB
Del
OK
Queue.pyc
9.19 KB
Del
OK
Queue.pyo
9.19 KB
Del
OK
SimpleHTTPServer.py
7.25 KB
Del
OK
SimpleHTTPServer.pyc
7.55 KB
Del
OK
SimpleHTTPServer.pyo
7.55 KB
Del
OK
SimpleXMLRPCServer.py
25.17 KB
Del
OK
SimpleXMLRPCServer.pyc
22.31 KB
Del
OK
SimpleXMLRPCServer.pyo
22.31 KB
Del
OK
SocketServer.py
23.29 KB
Del
OK
SocketServer.pyc
23.49 KB
Del
OK
SocketServer.pyo
23.49 KB
Del
OK
StringIO.py
10.41 KB
Del
OK
StringIO.pyc
11.21 KB
Del
OK
StringIO.pyo
11.21 KB
Del
OK
Tools
-
Del
OK
UserDict.py
5.67 KB
Del
OK
UserDict.pyc
8.61 KB
Del
OK
UserDict.pyo
8.61 KB
Del
OK
UserList.py
3.56 KB
Del
OK
UserList.pyc
6.42 KB
Del
OK
UserList.pyo
6.42 KB
Del
OK
UserString.py
9.46 KB
Del
OK
UserString.pyc
14.52 KB
Del
OK
UserString.pyo
14.52 KB
Del
OK
_LWPCookieJar.py
6.4 KB
Del
OK
_LWPCookieJar.pyc
5.4 KB
Del
OK
_LWPCookieJar.pyo
5.4 KB
Del
OK
_MozillaCookieJar.py
5.67 KB
Del
OK
_MozillaCookieJar.pyc
4.37 KB
Del
OK
_MozillaCookieJar.pyo
4.33 KB
Del
OK
__future__.py
4.28 KB
Del
OK
__future__.pyc
4.13 KB
Del
OK
__future__.pyo
4.13 KB
Del
OK
__phello__.foo.py
64 B
Del
OK
__phello__.foo.pyc
125 B
Del
OK
__phello__.foo.pyo
125 B
Del
OK
_abcoll.py
17.45 KB
Del
OK
_abcoll.pyc
24.4 KB
Del
OK
_abcoll.pyo
24.4 KB
Del
OK
_osx_support.py
18.03 KB
Del
OK
_osx_support.pyc
11.28 KB
Del
OK
_osx_support.pyo
11.28 KB
Del
OK
_pyio.py
67.24 KB
Del
OK
_pyio.pyc
62.71 KB
Del
OK
_pyio.pyo
62.71 KB
Del
OK
_strptime.py
19.75 KB
Del
OK
_strptime.pyc
14.53 KB
Del
OK
_strptime.pyo
14.53 KB
Del
OK
_sysconfigdata.py
17.56 KB
Del
OK
_sysconfigdata.pyc
20.72 KB
Del
OK
_sysconfigdata.pyo
20.72 KB
Del
OK
_threading_local.py
7.28 KB
Del
OK
_threading_local.pyc
6.45 KB
Del
OK
_threading_local.pyo
6.45 KB
Del
OK
_weakrefset.py
5.48 KB
Del
OK
_weakrefset.pyc
9.25 KB
Del
OK
_weakrefset.pyo
9.25 KB
Del
OK
abc.py
6.98 KB
Del
OK
abc.pyc
6 KB
Del
OK
abc.pyo
5.94 KB
Del
OK
aifc.py
32.94 KB
Del
OK
aifc.pyc
29.31 KB
Del
OK
aifc.pyo
29.31 KB
Del
OK
antigravity.py
60 B
Del
OK
antigravity.pyc
203 B
Del
OK
antigravity.pyo
203 B
Del
OK
anydbm.py
2.6 KB
Del
OK
anydbm.pyc
2.73 KB
Del
OK
anydbm.pyo
2.73 KB
Del
OK
argparse.py
86.46 KB
Del
OK
argparse.pyc
62.57 KB
Del
OK
argparse.pyo
62.41 KB
Del
OK
ast.py
11.53 KB
Del
OK
ast.pyc
12.65 KB
Del
OK
ast.pyo
12.65 KB
Del
OK
asynchat.py
11.13 KB
Del
OK
asynchat.pyc
8.44 KB
Del
OK
asynchat.pyo
8.44 KB
Del
OK
asyncore.py
20.36 KB
Del
OK
asyncore.pyc
18.4 KB
Del
OK
asyncore.pyo
18.4 KB
Del
OK
atexit.py
1.67 KB
Del
OK
atexit.pyc
2.15 KB
Del
OK
atexit.pyo
2.15 KB
Del
OK
audiodev.py
7.42 KB
Del
OK
audiodev.pyc
8.27 KB
Del
OK
audiodev.pyo
8.27 KB
Del
OK
base64.py
11.09 KB
Del
OK
base64.pyc
10.63 KB
Del
OK
base64.pyo
10.63 KB
Del
OK
bdb.py
21.21 KB
Del
OK
bdb.pyc
18.65 KB
Del
OK
bdb.pyo
18.65 KB
Del
OK
binhex.py
14.14 KB
Del
OK
binhex.pyc
15.04 KB
Del
OK
binhex.pyo
15.04 KB
Del
OK
bisect.py
2.53 KB
Del
OK
bisect.pyc
3 KB
Del
OK
bisect.pyo
3 KB
Del
OK
bsddb
-
Del
OK
cProfile.py
6.43 KB
Del
OK
cProfile.pyc
6.25 KB
Del
OK
cProfile.pyo
6.25 KB
Del
OK
calendar.py
22.76 KB
Del
OK
calendar.pyc
27.13 KB
Del
OK
calendar.pyo
27.13 KB
Del
OK
cgi.py
34.31 KB
Del
OK
cgi.pyc
31.99 KB
Del
OK
cgi.pyo
31.99 KB
Del
OK
cgitb.py
11.89 KB
Del
OK
cgitb.pyc
11.9 KB
Del
OK
cgitb.pyo
11.9 KB
Del
OK
chunk.py
5.25 KB
Del
OK
chunk.pyc
5.46 KB
Del
OK
chunk.pyo
5.46 KB
Del
OK
cmd.py
14.67 KB
Del
OK
cmd.pyc
13.71 KB
Del
OK
cmd.pyo
13.71 KB
Del
OK
code.py
9.95 KB
Del
OK
code.pyc
10.09 KB
Del
OK
code.pyo
10.09 KB
Del
OK
codecs.py
34.44 KB
Del
OK
codecs.pyc
35.74 KB
Del
OK
codecs.pyo
35.74 KB
Del
OK
codeop.py
5.86 KB
Del
OK
codeop.pyc
6.44 KB
Del
OK
codeop.pyo
6.44 KB
Del
OK
collections.py
25.28 KB
Del
OK
collections.pyc
23.99 KB
Del
OK
collections.pyo
23.94 KB
Del
OK
colorsys.py
3.6 KB
Del
OK
colorsys.pyc
3.9 KB
Del
OK
colorsys.pyo
3.9 KB
Del
OK
commands.py
2.49 KB
Del
OK
commands.pyc
2.41 KB
Del
OK
commands.pyo
2.41 KB
Del
OK
compileall.py
7.58 KB
Del
OK
compileall.pyc
6.85 KB
Del
OK
compileall.pyo
6.85 KB
Del
OK
compiler
-
Del
OK
config
-
Del
OK
contextlib.py
4.32 KB
Del
OK
contextlib.pyc
4.35 KB
Del
OK
contextlib.pyo
4.35 KB
Del
OK
cookielib.py
63.21 KB
Del
OK
cookielib.pyc
53.55 KB
Del
OK
cookielib.pyo
53.37 KB
Del
OK
copy.py
11.25 KB
Del
OK
copy.pyc
11.91 KB
Del
OK
copy.pyo
11.82 KB
Del
OK
copy_reg.py
6.64 KB
Del
OK
copy_reg.pyc
4.99 KB
Del
OK
copy_reg.pyo
4.95 KB
Del
OK
crypt.py
2.24 KB
Del
OK
crypt.pyc
2.89 KB
Del
OK
crypt.pyo
2.89 KB
Del
OK
csv.py
15.96 KB
Del
OK
csv.pyc
13.14 KB
Del
OK
csv.pyo
13.14 KB
Del
OK
ctypes
-
Del
OK
curses
-
Del
OK
dbhash.py
498 B
Del
OK
dbhash.pyc
718 B
Del
OK
dbhash.pyo
718 B
Del
OK
decimal.py
215.84 KB
Del
OK
decimal.pyc
167.33 KB
Del
OK
decimal.pyo
167.33 KB
Del
OK
difflib.py
80.42 KB
Del
OK
difflib.pyc
60.5 KB
Del
OK
difflib.pyo
60.45 KB
Del
OK
dircache.py
1.1 KB
Del
OK
dircache.pyc
1.54 KB
Del
OK
dircache.pyo
1.54 KB
Del
OK
dis.py
6.35 KB
Del
OK
dis.pyc
6.08 KB
Del
OK
dis.pyo
6.08 KB
Del
OK
distutils
-
Del
OK
doctest.py
102.01 KB
Del
OK
doctest.pyc
81.45 KB
Del
OK
doctest.pyo
81.17 KB
Del
OK
dumbdbm.py
8.61 KB
Del
OK
dumbdbm.pyc
6.41 KB
Del
OK
dumbdbm.pyo
6.41 KB
Del
OK
dummy_thread.py
4.31 KB
Del
OK
dummy_thread.pyc
5.27 KB
Del
OK
dummy_thread.pyo
5.27 KB
Del
OK
dummy_threading.py
2.74 KB
Del
OK
dummy_threading.pyc
1.25 KB
Del
OK
dummy_threading.pyo
1.25 KB
Del
OK
email
-
Del
OK
encodings
-
Del
OK
filecmp.py
9.36 KB
Del
OK
filecmp.pyc
9.4 KB
Del
OK
filecmp.pyo
9.4 KB
Del
OK
fileinput.py
13.81 KB
Del
OK
fileinput.pyc
14.48 KB
Del
OK
fileinput.pyo
14.48 KB
Del
OK
fnmatch.py
3.16 KB
Del
OK
fnmatch.pyc
3.45 KB
Del
OK
fnmatch.pyo
3.45 KB
Del
OK
formatter.py
14.56 KB
Del
OK
formatter.pyc
18.73 KB
Del
OK
formatter.pyo
18.73 KB
Del
OK
fpformat.py
4.59 KB
Del
OK
fpformat.pyc
4.56 KB
Del
OK
fpformat.pyo
4.56 KB
Del
OK
fractions.py
21.87 KB
Del
OK
fractions.pyc
19.27 KB
Del
OK
fractions.pyo
19.27 KB
Del
OK
ftplib.py
36.1 KB
Del
OK
ftplib.pyc
33.38 KB
Del
OK
ftplib.pyo
33.38 KB
Del
OK
functools.py
4.37 KB
Del
OK
functools.pyc
5.95 KB
Del
OK
functools.pyo
5.95 KB
Del
OK
genericpath.py
2.94 KB
Del
OK
genericpath.pyc
3.19 KB
Del
OK
genericpath.pyo
3.19 KB
Del
OK
getopt.py
7.15 KB
Del
OK
getopt.pyc
6.5 KB
Del
OK
getopt.pyo
6.45 KB
Del
OK
getpass.py
5.43 KB
Del
OK
getpass.pyc
4.63 KB
Del
OK
getpass.pyo
4.63 KB
Del
OK
gettext.py
19.47 KB
Del
OK
gettext.pyc
15.19 KB
Del
OK
gettext.pyo
15.19 KB
Del
OK
glob.py
2.86 KB
Del
OK
glob.pyc
2.83 KB
Del
OK
glob.pyo
2.83 KB
Del
OK
gzip.py
18.26 KB
Del
OK
gzip.pyc
14.72 KB
Del
OK
gzip.pyo
14.72 KB
Del
OK
hashlib.py
7.48 KB
Del
OK
hashlib.pyc
6.74 KB
Del
OK
hashlib.pyo
6.74 KB
Del
OK
heapq.py
17.76 KB
Del
OK
heapq.pyc
14.13 KB
Del
OK
heapq.pyo
14.13 KB
Del
OK
hmac.py
4.48 KB
Del
OK
hmac.pyc
4.44 KB
Del
OK
hmac.pyo
4.44 KB
Del
OK
hotshot
-
Del
OK
htmlentitydefs.py
17.63 KB
Del
OK
htmlentitydefs.pyc
6.22 KB
Del
OK
htmlentitydefs.pyo
6.22 KB
Del
OK
htmllib.py
12.57 KB
Del
OK
htmllib.pyc
19.83 KB
Del
OK
htmllib.pyo
19.83 KB
Del
OK
httplib.py
51.37 KB
Del
OK
httplib.pyc
37.54 KB
Del
OK
httplib.pyo
37.37 KB
Del
OK
idlelib
-
Del
OK
ihooks.py
18.54 KB
Del
OK
ihooks.pyc
20.87 KB
Del
OK
ihooks.pyo
20.87 KB
Del
OK
imaplib.py
47.34 KB
Del
OK
imaplib.pyc
44.45 KB
Del
OK
imaplib.pyo
41.8 KB
Del
OK
imghdr.py
3.46 KB
Del
OK
imghdr.pyc
4.73 KB
Del
OK
imghdr.pyo
4.73 KB
Del
OK
importlib
-
Del
OK
imputil.py
25.16 KB
Del
OK
imputil.pyc
15.26 KB
Del
OK
imputil.pyo
15.08 KB
Del
OK
inspect.py
41.47 KB
Del
OK
inspect.pyc
39.04 KB
Del
OK
inspect.pyo
39.04 KB
Del
OK
io.py
3.12 KB
Del
OK
io.pyc
3.4 KB
Del
OK
io.pyo
3.4 KB
Del
OK
json
-
Del
OK
keyword.py
1.95 KB
Del
OK
keyword.pyc
2.06 KB
Del
OK
keyword.pyo
2.06 KB
Del
OK
lib-dynload
-
Del
OK
lib-tk
-
Del
OK
lib2to3
-
Del
OK
linecache.py
3.87 KB
Del
OK
linecache.pyc
3.14 KB
Del
OK
linecache.pyo
3.14 KB
Del
OK
locale.py
87.33 KB
Del
OK
locale.pyc
48.77 KB
Del
OK
locale.pyo
48.77 KB
Del
OK
logging
-
Del
OK
macpath.py
6.11 KB
Del
OK
macpath.pyc
7.47 KB
Del
OK
macpath.pyo
7.47 KB
Del
OK
macurl2path.py
3.2 KB
Del
OK
macurl2path.pyc
2.71 KB
Del
OK
macurl2path.pyo
2.71 KB
Del
OK
mailbox.py
78.86 KB
Del
OK
mailbox.pyc
74.87 KB
Del
OK
mailbox.pyo
74.82 KB
Del
OK
mailcap.py
8.2 KB
Del
OK
mailcap.pyc
7.77 KB
Del
OK
mailcap.pyo
7.77 KB
Del
OK
markupbase.py
14.3 KB
Del
OK
markupbase.pyc
9.08 KB
Del
OK
markupbase.pyo
8.89 KB
Del
OK
md5.py
358 B
Del
OK
md5.pyc
378 B
Del
OK
md5.pyo
378 B
Del
OK
mhlib.py
32.65 KB
Del
OK
mhlib.pyc
33.01 KB
Del
OK
mhlib.pyo
33.01 KB
Del
OK
mimetools.py
7 KB
Del
OK
mimetools.pyc
8.03 KB
Del
OK
mimetools.pyo
8.03 KB
Del
OK
mimetypes.py
20.22 KB
Del
OK
mimetypes.pyc
17.86 KB
Del
OK
mimetypes.pyo
17.86 KB
Del
OK
mimify.py
14.67 KB
Del
OK
mimify.pyc
11.71 KB
Del
OK
mimify.pyo
11.71 KB
Del
OK
modulefinder.py
23.71 KB
Del
OK
modulefinder.pyc
18.27 KB
Del
OK
modulefinder.pyo
18.19 KB
Del
OK
multifile.py
4.71 KB
Del
OK
multifile.pyc
5.29 KB
Del
OK
multifile.pyo
5.25 KB
Del
OK
multiprocessing
-
Del
OK
mutex.py
1.83 KB
Del
OK
mutex.pyc
2.46 KB
Del
OK
mutex.pyo
2.46 KB
Del
OK
netrc.py
4.47 KB
Del
OK
netrc.pyc
3.83 KB
Del
OK
netrc.pyo
3.83 KB
Del
OK
new.py
610 B
Del
OK
new.pyc
862 B
Del
OK
new.pyo
862 B
Del
OK
nntplib.py
20.97 KB
Del
OK
nntplib.pyc
20.55 KB
Del
OK
nntplib.pyo
20.55 KB
Del
OK
ntpath.py
18.02 KB
Del
OK
ntpath.pyc
11.6 KB
Del
OK
ntpath.pyo
11.56 KB
Del
OK
nturl2path.py
2.32 KB
Del
OK
nturl2path.pyc
1.77 KB
Del
OK
nturl2path.pyo
1.77 KB
Del
OK
numbers.py
10.08 KB
Del
OK
numbers.pyc
13.68 KB
Del
OK
numbers.pyo
13.68 KB
Del
OK
opcode.py
5.35 KB
Del
OK
opcode.pyc
6 KB
Del
OK
opcode.pyo
6 KB
Del
OK
optparse.py
59.69 KB
Del
OK
optparse.pyc
52.78 KB
Del
OK
optparse.pyo
52.7 KB
Del
OK
os.py
25.17 KB
Del
OK
os.pyc
24.96 KB
Del
OK
os.pyo
24.96 KB
Del
OK
os2emxpath.py
4.5 KB
Del
OK
os2emxpath.pyc
4.39 KB
Del
OK
os2emxpath.pyo
4.39 KB
Del
OK
pdb.doc
7.73 KB
Del
OK
pdb.py
44.94 KB
Del
OK
pdb.pyc
42.59 KB
Del
OK
pdb.pyo
42.59 KB
Del
OK
pickle.py
44.09 KB
Del
OK
pickle.pyc
37.56 KB
Del
OK
pickle.pyo
37.37 KB
Del
OK
pickletools.py
72.79 KB
Del
OK
pickletools.pyc
55.77 KB
Del
OK
pickletools.pyo
54.95 KB
Del
OK
pipes.py
9.36 KB
Del
OK
pipes.pyc
9.09 KB
Del
OK
pipes.pyo
9.09 KB
Del
OK
pkgutil.py
19.87 KB
Del
OK
pkgutil.pyc
18.49 KB
Del
OK
pkgutil.pyo
18.49 KB
Del
OK
plat-linux2
-
Del
OK
platform.py
51.98 KB
Del
OK
platform.pyc
36.06 KB
Del
OK
platform.pyo
36.06 KB
Del
OK
plistlib.py
15.44 KB
Del
OK
plistlib.pyc
19.52 KB
Del
OK
plistlib.pyo
19.44 KB
Del
OK
popen2.py
8.22 KB
Del
OK
popen2.pyc
8.81 KB
Del
OK
popen2.pyo
8.77 KB
Del
OK
poplib.py
12.64 KB
Del
OK
poplib.pyc
13.16 KB
Del
OK
poplib.pyo
13.16 KB
Del
OK
posixfile.py
7.82 KB
Del
OK
posixfile.pyc
7.47 KB
Del
OK
posixfile.pyo
7.47 KB
Del
OK
posixpath.py
13.27 KB
Del
OK
posixpath.pyc
11.03 KB
Del
OK
posixpath.pyo
11.03 KB
Del
OK
pprint.py
11.73 KB
Del
OK
pprint.pyc
10.06 KB
Del
OK
pprint.pyo
9.89 KB
Del
OK
profile.py
22.25 KB
Del
OK
profile.pyc
16.07 KB
Del
OK
profile.pyo
15.83 KB
Del
OK
pstats.py
26.08 KB
Del
OK
pstats.pyc
24.43 KB
Del
OK
pstats.pyo
24.43 KB
Del
OK
pty.py
4.94 KB
Del
OK
pty.pyc
4.85 KB
Del
OK
pty.pyo
4.85 KB
Del
OK
py_compile.py
5.79 KB
Del
OK
py_compile.pyc
6.27 KB
Del
OK
py_compile.pyo
6.27 KB
Del
OK
pyclbr.py
13.07 KB
Del
OK
pyclbr.pyc
9.42 KB
Del
OK
pyclbr.pyo
9.42 KB
Del
OK
pydoc.py
91.12 KB
Del
OK
pydoc.pyc
88.35 KB
Del
OK
pydoc.pyo
88.29 KB
Del
OK
pydoc_data
-
Del
OK
quopri.py
6.81 KB
Del
OK
quopri.pyc
6.42 KB
Del
OK
quopri.pyo
6.42 KB
Del
OK
random.py
31.45 KB
Del
OK
random.pyc
24.99 KB
Del
OK
random.pyo
24.99 KB
Del
OK
re.py
12.66 KB
Del
OK
re.pyc
12.79 KB
Del
OK
re.pyo
12.79 KB
Del
OK
repr.py
4.2 KB
Del
OK
repr.pyc
5.26 KB
Del
OK
repr.pyo
5.26 KB
Del
OK
rexec.py
19.68 KB
Del
OK
rexec.pyc
23.58 KB
Del
OK
rexec.pyo
23.58 KB
Del
OK
rfc822.py
32.51 KB
Del
OK
rfc822.pyc
31.05 KB
Del
OK
rfc822.pyo
31.05 KB
Del
OK
rlcompleter.py
5.68 KB
Del
OK
rlcompleter.pyc
5.84 KB
Del
OK
rlcompleter.pyo
5.84 KB
Del
OK
robotparser.py
7.03 KB
Del
OK
robotparser.pyc
7.7 KB
Del
OK
robotparser.pyo
7.7 KB
Del
OK
runpy.py
10.45 KB
Del
OK
runpy.pyc
8.21 KB
Del
OK
runpy.pyo
8.21 KB
Del
OK
sched.py
4.97 KB
Del
OK
sched.pyc
4.88 KB
Del
OK
sched.pyo
4.88 KB
Del
OK
sets.py
18.6 KB
Del
OK
sets.pyc
16.5 KB
Del
OK
sets.pyo
16.5 KB
Del
OK
sgmllib.py
17.46 KB
Del
OK
sgmllib.pyc
15.07 KB
Del
OK
sgmllib.pyo
15.07 KB
Del
OK
sha.py
393 B
Del
OK
sha.pyc
421 B
Del
OK
sha.pyo
421 B
Del
OK
shelve.py
7.89 KB
Del
OK
shelve.pyc
10.03 KB
Del
OK
shelve.pyo
10.03 KB
Del
OK
shlex.py
10.88 KB
Del
OK
shlex.pyc
7.37 KB
Del
OK
shlex.pyo
7.37 KB
Del
OK
shutil.py
18.46 KB
Del
OK
shutil.pyc
18.1 KB
Del
OK
shutil.pyo
18.1 KB
Del
OK
site-packages
-
Del
OK
site.py
19.61 KB
Del
OK
site.pyc
19.11 KB
Del
OK
site.pyo
19.11 KB
Del
OK
smtpd.py
18.11 KB
Del
OK
smtpd.pyc
15.52 KB
Del
OK
smtpd.pyo
15.52 KB
Del
OK
smtplib.py
30.9 KB
Del
OK
smtplib.pyc
29.29 KB
Del
OK
smtplib.pyo
29.29 KB
Del
OK
sndhdr.py
5.83 KB
Del
OK
sndhdr.pyc
7.18 KB
Del
OK
sndhdr.pyo
7.18 KB
Del
OK
socket.py
20.03 KB
Del
OK
socket.pyc
15.73 KB
Del
OK
socket.pyo
15.64 KB
Del
OK
sqlite3
-
Del
OK
sre.py
384 B
Del
OK
sre.pyc
519 B
Del
OK
sre.pyo
519 B
Del
OK
sre_compile.py
15.99 KB
Del
OK
sre_compile.pyc
10.76 KB
Del
OK
sre_compile.pyo
10.65 KB
Del
OK
sre_constants.py
6.95 KB
Del
OK
sre_constants.pyc
5.97 KB
Del
OK
sre_constants.pyo
5.97 KB
Del
OK
sre_parse.py
26.84 KB
Del
OK
sre_parse.pyc
18.98 KB
Del
OK
sre_parse.pyo
18.98 KB
Del
OK
ssl.py
38.7 KB
Del
OK
ssl.pyc
32.05 KB
Del
OK
ssl.pyo
32.05 KB
Del
OK
stat.py
1.8 KB
Del
OK
stat.pyc
2.69 KB
Del
OK
stat.pyo
2.69 KB
Del
OK
statvfs.py
898 B
Del
OK
statvfs.pyc
620 B
Del
OK
statvfs.pyo
620 B
Del
OK
string.py
20.27 KB
Del
OK
string.pyc
19.54 KB
Del
OK
string.pyo
19.54 KB
Del
OK
stringold.py
12.16 KB
Del
OK
stringold.pyc
12.25 KB
Del
OK
stringold.pyo
12.25 KB
Del
OK
stringprep.py
13.21 KB
Del
OK
stringprep.pyc
14.15 KB
Del
OK
stringprep.pyo
14.08 KB
Del
OK
struct.py
82 B
Del
OK
struct.pyc
239 B
Del
OK
struct.pyo
239 B
Del
OK
subprocess.py
57.68 KB
Del
OK
subprocess.pyc
40.93 KB
Del
OK
subprocess.pyo
40.93 KB
Del
OK
sunau.py
16.15 KB
Del
OK
sunau.pyc
17.53 KB
Del
OK
sunau.pyo
17.53 KB
Del
OK
sunaudio.py
1.37 KB
Del
OK
sunaudio.pyc
1.94 KB
Del
OK
sunaudio.pyo
1.94 KB
Del
OK
symbol.py
2.01 KB
Del
OK
symbol.pyc
2.96 KB
Del
OK
symbol.pyo
2.96 KB
Del
OK
symtable.py
7.34 KB
Del
OK
symtable.pyc
11.59 KB
Del
OK
symtable.pyo
11.46 KB
Del
OK
sysconfig.py
21.88 KB
Del
OK
sysconfig.pyc
17.23 KB
Del
OK
sysconfig.pyo
17.23 KB
Del
OK
tabnanny.py
11.07 KB
Del
OK
tabnanny.pyc
8.05 KB
Del
OK
tabnanny.pyo
8.05 KB
Del
OK
tarfile.py
88.12 KB
Del
OK
tarfile.pyc
73.84 KB
Del
OK
tarfile.pyo
73.84 KB
Del
OK
telnetlib.py
26.18 KB
Del
OK
telnetlib.pyc
22.53 KB
Del
OK
telnetlib.pyo
22.53 KB
Del
OK
tempfile.py
17.91 KB
Del
OK
tempfile.pyc
19.35 KB
Del
OK
tempfile.pyo
19.35 KB
Del
OK
test
-
Del
OK
textwrap.py
16.64 KB
Del
OK
textwrap.pyc
11.62 KB
Del
OK
textwrap.pyo
11.53 KB
Del
OK
this.py
1002 B
Del
OK
this.pyc
1.19 KB
Del
OK
this.pyo
1.19 KB
Del
OK
threading.py
46.28 KB
Del
OK
threading.pyc
41.7 KB
Del
OK
threading.pyo
39.58 KB
Del
OK
timeit.py
11.82 KB
Del
OK
timeit.pyc
11.5 KB
Del
OK
timeit.pyo
11.5 KB
Del
OK
toaiff.py
3.07 KB
Del
OK
toaiff.pyc
3.03 KB
Del
OK
toaiff.pyo
3.03 KB
Del
OK
token.py
2.88 KB
Del
OK
token.pyc
3.73 KB
Del
OK
token.pyo
3.73 KB
Del
OK
tokenize.py
16.15 KB
Del
OK
tokenize.pyc
13.61 KB
Del
OK
tokenize.pyo
13.52 KB
Del
OK
trace.py
29.19 KB
Del
OK
trace.pyc
22.26 KB
Del
OK
trace.pyo
22.2 KB
Del
OK
traceback.py
10.99 KB
Del
OK
traceback.pyc
11.35 KB
Del
OK
traceback.pyo
11.35 KB
Del
OK
tty.py
879 B
Del
OK
tty.pyc
1.29 KB
Del
OK
tty.pyo
1.29 KB
Del
OK
types.py
1.99 KB
Del
OK
types.pyc
2.45 KB
Del
OK
types.pyo
2.45 KB
Del
OK
unittest
-
Del
OK
urllib.py
57.14 KB
Del
OK
urllib.pyc
49.1 KB
Del
OK
urllib.pyo
49 KB
Del
OK
urllib2.py
52.13 KB
Del
OK
urllib2.pyc
46.61 KB
Del
OK
urllib2.pyo
46.52 KB
Del
OK
urlparse.py
16.82 KB
Del
OK
urlparse.pyc
15.67 KB
Del
OK
urlparse.pyo
15.67 KB
Del
OK
user.py
1.59 KB
Del
OK
user.pyc
1.68 KB
Del
OK
user.pyo
1.68 KB
Del
OK
uu.py
6.4 KB
Del
OK
uu.pyc
4.21 KB
Del
OK
uu.pyo
4.21 KB
Del
OK
uuid.py
20.6 KB
Del
OK
uuid.pyc
20.68 KB
Del
OK
uuid.pyo
20.68 KB
Del
OK
warnings.py
13.71 KB
Del
OK
warnings.pyc
12.84 KB
Del
OK
warnings.pyo
12.02 KB
Del
OK
wave.py
17.67 KB
Del
OK
wave.pyc
19 KB
Del
OK
wave.pyo
18.94 KB
Del
OK
weakref.py
10.44 KB
Del
OK
weakref.pyc
13.72 KB
Del
OK
weakref.pyo
13.72 KB
Del
OK
webbrowser.py
22.68 KB
Del
OK
webbrowser.pyc
19.83 KB
Del
OK
webbrowser.pyo
19.78 KB
Del
OK
whichdb.py
3.3 KB
Del
OK
whichdb.pyc
2.19 KB
Del
OK
whichdb.pyo
2.19 KB
Del
OK
wsgiref
-
Del
OK
wsgiref.egg-info
187 B
Del
OK
xdrlib.py
5.43 KB
Del
OK
xdrlib.pyc
9.07 KB
Del
OK
xdrlib.pyo
9.07 KB
Del
OK
xml
-
Del
OK
xmllib.py
34.05 KB
Del
OK
xmllib.pyc
26.22 KB
Del
OK
xmllib.pyo
26.22 KB
Del
OK
xmlrpclib.py
50.78 KB
Del
OK
xmlrpclib.pyc
42.89 KB
Del
OK
xmlrpclib.pyo
42.71 KB
Del
OK
zipfile.py
56.45 KB
Del
OK
zipfile.pyc
40.33 KB
Del
OK
zipfile.pyo
40.33 KB
Del
OK
Edit: imaplib.py
"""IMAP4 client. Based on RFC 2060. Public class: IMAP4 Public variable: Debug Public functions: Internaldate2tuple Int2AP ParseFlags Time2Internaldate """ # Author: Piers Lauder <piers@cs.su.oz.au> December 1997. # # Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998. # String method conversion by ESR, February 2001. # GET/SETACL contributed by Anthony Baxter <anthony@interlink.com.au> April 2001. # IMAP4_SSL contributed by Tino Lange <Tino.Lange@isg.de> March 2002. # GET/SETQUOTA contributed by Andreas Zeidler <az@kreativkombinat.de> June 2002. # PROXYAUTH contributed by Rick Holbert <holbert.13@osu.edu> November 2002. # GET/SETANNOTATION contributed by Tomas Lindroos <skitta@abo.fi> June 2005. __version__ = "2.58" import binascii, errno, random, re, socket, subprocess, sys, time __all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate"] # Globals CRLF = '\r\n' Debug = 0 IMAP4_PORT = 143 IMAP4_SSL_PORT = 993 AllowedVersions = ('IMAP4REV1', 'IMAP4') # Most recent first # Maximal line length when calling readline(). This is to prevent # reading arbitrary length lines. RFC 3501 and 2060 (IMAP 4rev1) # don't specify a line length. RFC 2683 suggests limiting client # command lines to 1000 octets and that servers should be prepared # to accept command lines up to 8000 octets, so we used to use 10K here. # In the modern world (eg: gmail) the response to, for example, a # search command can be quite large, so we now use 1M. _MAXLINE = 1000000 # Commands Commands = { # name valid states 'APPEND': ('AUTH', 'SELECTED'), 'AUTHENTICATE': ('NONAUTH',), 'CAPABILITY': ('NONAUTH', 'AUTH', 'SELECTED', 'LOGOUT'), 'CHECK': ('SELECTED',), 'CLOSE': ('SELECTED',), 'COPY': ('SELECTED',), 'CREATE': ('AUTH', 'SELECTED'), 'DELETE': ('AUTH', 'SELECTED'), 'DELETEACL': ('AUTH', 'SELECTED'), 'EXAMINE': ('AUTH', 'SELECTED'), 'EXPUNGE': ('SELECTED',), 'FETCH': ('SELECTED',), 'GETACL': ('AUTH', 'SELECTED'), 'GETANNOTATION':('AUTH', 'SELECTED'), 'GETQUOTA': ('AUTH', 'SELECTED'), 'GETQUOTAROOT': ('AUTH', 'SELECTED'), 'MYRIGHTS': ('AUTH', 'SELECTED'), 'LIST': ('AUTH', 'SELECTED'), 'LOGIN': ('NONAUTH',), 'LOGOUT': ('NONAUTH', 'AUTH', 'SELECTED', 'LOGOUT'), 'LSUB': ('AUTH', 'SELECTED'), 'NAMESPACE': ('AUTH', 'SELECTED'), 'NOOP': ('NONAUTH', 'AUTH', 'SELECTED', 'LOGOUT'), 'PARTIAL': ('SELECTED',), # NB: obsolete 'PROXYAUTH': ('AUTH',), 'RENAME': ('AUTH', 'SELECTED'), 'SEARCH': ('SELECTED',), 'SELECT': ('AUTH', 'SELECTED'), 'SETACL': ('AUTH', 'SELECTED'), 'SETANNOTATION':('AUTH', 'SELECTED'), 'SETQUOTA': ('AUTH', 'SELECTED'), 'SORT': ('SELECTED',), 'STATUS': ('AUTH', 'SELECTED'), 'STORE': ('SELECTED',), 'SUBSCRIBE': ('AUTH', 'SELECTED'), 'THREAD': ('SELECTED',), 'UID': ('SELECTED',), 'UNSUBSCRIBE': ('AUTH', 'SELECTED'), } # Patterns to match server responses Continuation = re.compile(r'\+( (?P<data>.*))?') Flags = re.compile(r'.*FLAGS \((?P<flags>[^\)]*)\)') InternalDate = re.compile(r'.*INTERNALDATE "' r'(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9])' r' (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9])' r' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])' r'"') Literal = re.compile(r'.*{(?P<size>\d+)}$') MapCRLF = re.compile(r'\r\n|\r|\n') Response_code = re.compile(r'\[(?P<type>[A-Z-]+)( (?P<data>[^\]]*))?\]') Untagged_response = re.compile(r'\* (?P<type>[A-Z-]+)( (?P<data>.*))?') Untagged_status = re.compile(r'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?') _control_chars = re.compile('[\x00-\x1f\x7f]') class IMAP4: """IMAP4 client class. Instantiate with: IMAP4([host[, port]]) host - host's name (default: localhost); port - port number (default: standard IMAP4 port). All IMAP4rev1 commands are supported by methods of the same name (in lower-case). All arguments to commands are converted to strings, except for AUTHENTICATE, and the last argument to APPEND which is passed as an IMAP4 literal. If necessary (the string contains any non-printing characters or white-space and isn't enclosed with either parentheses or double quotes) each string is quoted. However, the 'password' argument to the LOGIN command is always quoted. If you want to avoid having an argument string quoted (eg: the 'flags' argument to STORE) then enclose the string in parentheses (eg: "(\Deleted)"). Each command returns a tuple: (type, [data, ...]) where 'type' is usually 'OK' or 'NO', and 'data' is either the text from the tagged response, or untagged results from command. Each 'data' is either a string, or a tuple. If a tuple, then the first part is the header of the response, and the second part contains the data (ie: 'literal' value). Errors raise the exception class <instance>.error("<reason>"). IMAP4 server errors raise <instance>.abort("<reason>"), which is a sub-class of 'error'. Mailbox status changes from READ-WRITE to READ-ONLY raise the exception class <instance>.readonly("<reason>"), which is a sub-class of 'abort'. "error" exceptions imply a program error. "abort" exceptions imply the connection should be reset, and the command re-tried. "readonly" exceptions imply the command should be re-tried. Note: to use this module, you must read the RFCs pertaining to the IMAP4 protocol, as the semantics of the arguments to each IMAP4 command are left to the invoker, not to mention the results. Also, most IMAP servers implement a sub-set of the commands available here. """ class error(Exception): pass # Logical errors - debug required class abort(error): pass # Service errors - close and retry class readonly(abort): pass # Mailbox status changed to READ-ONLY mustquote = re.compile(r"[^\w!#$%&'*+,.:;<=>?^`|~-]") def __init__(self, host = '', port = IMAP4_PORT): self.debug = Debug self.state = 'LOGOUT' self.literal = None # A literal argument to a command self.tagged_commands = {} # Tagged commands awaiting response self.untagged_responses = {} # {typ: [data, ...], ...} self.continuation_response = '' # Last continuation response self.is_readonly = False # READ-ONLY desired state self.tagnum = 0 # Open socket to server. self.open(host, port) # Create unique tag for this session, # and compile tagged response matcher. self.tagpre = Int2AP(random.randint(4096, 65535)) self.tagre = re.compile(r'(?P<tag>' + self.tagpre + r'\d+) (?P<type>[A-Z]+) (?P<data>.*)') # Get server welcome message, # request and store CAPABILITY response. if __debug__: self._cmd_log_len = 10 self._cmd_log_idx = 0 self._cmd_log = {} # Last `_cmd_log_len' interactions if self.debug >= 1: self._mesg('imaplib version %s' % __version__) self._mesg('new IMAP4 connection, tag=%s' % self.tagpre) self.welcome = self._get_response() if 'PREAUTH' in self.untagged_responses: self.state = 'AUTH' elif 'OK' in self.untagged_responses: self.state = 'NONAUTH' else: raise self.error(self.welcome) typ, dat = self.capability() if dat == [None]: raise self.error('no CAPABILITY response from server') self.capabilities = tuple(dat[-1].upper().split()) if __debug__: if self.debug >= 3: self._mesg('CAPABILITIES: %r' % (self.capabilities,)) for version in AllowedVersions: if not version in self.capabilities: continue self.PROTOCOL_VERSION = version return raise self.error('server not IMAP4 compliant') def __getattr__(self, attr): # Allow UPPERCASE variants of IMAP4 command methods. if attr in Commands: return getattr(self, attr.lower()) raise AttributeError("Unknown IMAP4 command: '%s'" % attr) # Overridable methods def open(self, host = '', port = IMAP4_PORT): """Setup connection to remote server on "host:port" (default: localhost:standard IMAP4 port). This connection will be used by the routines: read, readline, send, shutdown. """ self.host = host self.port = port self.sock = socket.create_connection((host, port)) self.file = self.sock.makefile('rb') def read(self, size): """Read 'size' bytes from remote.""" return self.file.read(size) def readline(self): """Read line from remote.""" line = self.file.readline(_MAXLINE + 1) if len(line) > _MAXLINE: raise self.error("got more than %d bytes" % _MAXLINE) return line def send(self, data): """Send data to remote.""" self.sock.sendall(data) def shutdown(self): """Close I/O established in "open".""" self.file.close() try: self.sock.shutdown(socket.SHUT_RDWR) except socket.error as e: # The server might already have closed the connection if e.errno != errno.ENOTCONN: raise finally: self.sock.close() def socket(self): """Return socket instance used to connect to IMAP4 server. socket = <instance>.socket() """ return self.sock # Utility methods def recent(self): """Return most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command. (typ, [data]) = <instance>.recent() 'data' is None if no new messages, else list of RECENT responses, most recent last. """ name = 'RECENT' typ, dat = self._untagged_response('OK', [None], name) if dat[-1]: return typ, dat typ, dat = self.noop() # Prod server for response return self._untagged_response(typ, dat, name) def response(self, code): """Return data for response 'code' if received, or None. Old value for response 'code' is cleared. (code, [data]) = <instance>.response(code) """ return self._untagged_response(code, [None], code.upper()) # IMAP4 commands def append(self, mailbox, flags, date_time, message): """Append message to named mailbox. (typ, [data]) = <instance>.append(mailbox, flags, date_time, message) All args except `message' can be None. """ name = 'APPEND' if not mailbox: mailbox = 'INBOX' if flags: if (flags[0],flags[-1]) != ('(',')'): flags = '(%s)' % flags else: flags = None if date_time: date_time = Time2Internaldate(date_time) else: date_time = None self.literal = MapCRLF.sub(CRLF, message) return self._simple_command(name, mailbox, flags, date_time) def authenticate(self, mechanism, authobject): """Authenticate command - requires response processing. 'mechanism' specifies which authentication mechanism is to be used - it must appear in <instance>.capabilities in the form AUTH=<mechanism>. 'authobject' must be a callable object: data = authobject(response) It will be called to process server continuation responses. It should return data that will be encoded and sent to server. It should return None if the client abort response '*' should be sent instead. """ mech = mechanism.upper() # XXX: shouldn't this code be removed, not commented out? #cap = 'AUTH=%s' % mech #if not cap in self.capabilities: # Let the server decide! # raise self.error("Server doesn't allow %s authentication." % mech) self.literal = _Authenticator(authobject).process typ, dat = self._simple_command('AUTHENTICATE', mech) if typ != 'OK': raise self.error(dat[-1]) self.state = 'AUTH' return typ, dat def capability(self): """(typ, [data]) = <instance>.capability() Fetch capabilities list from server.""" name = 'CAPABILITY' typ, dat = self._simple_command(name) return self._untagged_response(typ, dat, name) def check(self): """Checkpoint mailbox on server. (typ, [data]) = <instance>.check() """ return self._simple_command('CHECK') def close(self): """Close currently selected mailbox. Deleted messages are removed from writable mailbox. This is the recommended command before 'LOGOUT'. (typ, [data]) = <instance>.close() """ try: typ, dat = self._simple_command('CLOSE') finally: self.state = 'AUTH' return typ, dat def copy(self, message_set, new_mailbox): """Copy 'message_set' messages onto end of 'new_mailbox'. (typ, [data]) = <instance>.copy(message_set, new_mailbox) """ return self._simple_command('COPY', message_set, new_mailbox) def create(self, mailbox): """Create new mailbox. (typ, [data]) = <instance>.create(mailbox) """ return self._simple_command('CREATE', mailbox) def delete(self, mailbox): """Delete old mailbox. (typ, [data]) = <instance>.delete(mailbox) """ return self._simple_command('DELETE', mailbox) def deleteacl(self, mailbox, who): """Delete the ACLs (remove any rights) set for who on mailbox. (typ, [data]) = <instance>.deleteacl(mailbox, who) """ return self._simple_command('DELETEACL', mailbox, who) def expunge(self): """Permanently remove deleted items from selected mailbox. Generates 'EXPUNGE' response for each deleted message. (typ, [data]) = <instance>.expunge() 'data' is list of 'EXPUNGE'd message numbers in order received. """ name = 'EXPUNGE' typ, dat = self._simple_command(name) return self._untagged_response(typ, dat, name) def fetch(self, message_set, message_parts): """Fetch (parts of) messages. (typ, [data, ...]) = <instance>.fetch(message_set, message_parts) 'message_parts' should be a string of selected parts enclosed in parentheses, eg: "(UID BODY[TEXT])". 'data' are tuples of message part envelope and data. """ name = 'FETCH' typ, dat = self._simple_command(name, message_set, message_parts) return self._untagged_response(typ, dat, name) def getacl(self, mailbox): """Get the ACLs for a mailbox. (typ, [data]) = <instance>.getacl(mailbox) """ typ, dat = self._simple_command('GETACL', mailbox) return self._untagged_response(typ, dat, 'ACL') def getannotation(self, mailbox, entry, attribute): """(typ, [data]) = <instance>.getannotation(mailbox, entry, attribute) Retrieve ANNOTATIONs.""" typ, dat = self._simple_command('GETANNOTATION', mailbox, entry, attribute) return self._untagged_response(typ, dat, 'ANNOTATION') def getquota(self, root): """Get the quota root's resource usage and limits. Part of the IMAP4 QUOTA extension defined in rfc2087. (typ, [data]) = <instance>.getquota(root) """ typ, dat = self._simple_command('GETQUOTA', root) return self._untagged_response(typ, dat, 'QUOTA') def getquotaroot(self, mailbox): """Get the list of quota roots for the named mailbox. (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox) """ typ, dat = self._simple_command('GETQUOTAROOT', mailbox) typ, quota = self._untagged_response(typ, dat, 'QUOTA') typ, quotaroot = self._untagged_response(typ, dat, 'QUOTAROOT') return typ, [quotaroot, quota] def list(self, directory='""', pattern='*'): """List mailbox names in directory matching pattern. (typ, [data]) = <instance>.list(directory='""', pattern='*') 'data' is list of LIST responses. """ name = 'LIST' typ, dat = self._simple_command(name, directory, pattern) return self._untagged_response(typ, dat, name) def login(self, user, password): """Identify client using plaintext password. (typ, [data]) = <instance>.login(user, password) NB: 'password' will be quoted. """ typ, dat = self._simple_command('LOGIN', user, self._quote(password)) if typ != 'OK': raise self.error(dat[-1]) self.state = 'AUTH' return typ, dat def login_cram_md5(self, user, password): """ Force use of CRAM-MD5 authentication. (typ, [data]) = <instance>.login_cram_md5(user, password) """ self.user, self.password = user, password return self.authenticate('CRAM-MD5', self._CRAM_MD5_AUTH) def _CRAM_MD5_AUTH(self, challenge): """ Authobject to use with CRAM-MD5 authentication. """ import hmac return self.user + " " + hmac.HMAC(self.password, challenge).hexdigest() def logout(self): """Shutdown connection to server. (typ, [data]) = <instance>.logout() Returns server 'BYE' response. """ self.state = 'LOGOUT' try: typ, dat = self._simple_command('LOGOUT') except: typ, dat = 'NO', ['%s: %s' % sys.exc_info()[:2]] self.shutdown() if 'BYE' in self.untagged_responses: return 'BYE', self.untagged_responses['BYE'] return typ, dat def lsub(self, directory='""', pattern='*'): """List 'subscribed' mailbox names in directory matching pattern. (typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*') 'data' are tuples of message part envelope and data. """ name = 'LSUB' typ, dat = self._simple_command(name, directory, pattern) return self._untagged_response(typ, dat, name) def myrights(self, mailbox): """Show my ACLs for a mailbox (i.e. the rights that I have on mailbox). (typ, [data]) = <instance>.myrights(mailbox) """ typ,dat = self._simple_command('MYRIGHTS', mailbox) return self._untagged_response(typ, dat, 'MYRIGHTS') def namespace(self): """ Returns IMAP namespaces ala rfc2342 (typ, [data, ...]) = <instance>.namespace() """ name = 'NAMESPACE' typ, dat = self._simple_command(name) return self._untagged_response(typ, dat, name) def noop(self): """Send NOOP command. (typ, [data]) = <instance>.noop() """ if __debug__: if self.debug >= 3: self._dump_ur(self.untagged_responses) return self._simple_command('NOOP') def partial(self, message_num, message_part, start, length): """Fetch truncated part of a message. (typ, [data, ...]) = <instance>.partial(message_num, message_part, start, length) 'data' is tuple of message part envelope and data. """ name = 'PARTIAL' typ, dat = self._simple_command(name, message_num, message_part, start, length) return self._untagged_response(typ, dat, 'FETCH') def proxyauth(self, user): """Assume authentication as "user". Allows an authorised administrator to proxy into any user's mailbox. (typ, [data]) = <instance>.proxyauth(user) """ name = 'PROXYAUTH' return self._simple_command('PROXYAUTH', user) def rename(self, oldmailbox, newmailbox): """Rename old mailbox name to new. (typ, [data]) = <instance>.rename(oldmailbox, newmailbox) """ return self._simple_command('RENAME', oldmailbox, newmailbox) def search(self, charset, *criteria): """Search mailbox for matching messages. (typ, [data]) = <instance>.search(charset, criterion, ...) 'data' is space separated list of matching message numbers. """ name = 'SEARCH' if charset: typ, dat = self._simple_command(name, 'CHARSET', charset, *criteria) else: typ, dat = self._simple_command(name, *criteria) return self._untagged_response(typ, dat, name) def select(self, mailbox='INBOX', readonly=False): """Select a mailbox. Flush all untagged responses. (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=False) 'data' is count of messages in mailbox ('EXISTS' response). Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so other responses should be obtained via <instance>.response('FLAGS') etc. """ self.untagged_responses = {} # Flush old responses. self.is_readonly = readonly if readonly: name = 'EXAMINE' else: name = 'SELECT' typ, dat = self._simple_command(name, mailbox) if typ != 'OK': self.state = 'AUTH' # Might have been 'SELECTED' return typ, dat self.state = 'SELECTED' if 'READ-ONLY' in self.untagged_responses \ and not readonly: if __debug__: if self.debug >= 1: self._dump_ur(self.untagged_responses) raise self.readonly('%s is not writable' % mailbox) return typ, self.untagged_responses.get('EXISTS', [None]) def setacl(self, mailbox, who, what): """Set a mailbox acl. (typ, [data]) = <instance>.setacl(mailbox, who, what) """ return self._simple_command('SETACL', mailbox, who, what) def setannotation(self, *args): """(typ, [data]) = <instance>.setannotation(mailbox[, entry, attribute]+) Set ANNOTATIONs.""" typ, dat = self._simple_command('SETANNOTATION', *args) return self._untagged_response(typ, dat, 'ANNOTATION') def setquota(self, root, limits): """Set the quota root's resource limits. (typ, [data]) = <instance>.setquota(root, limits) """ typ, dat = self._simple_command('SETQUOTA', root, limits) return self._untagged_response(typ, dat, 'QUOTA') def sort(self, sort_criteria, charset, *search_criteria): """IMAP4rev1 extension SORT command. (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...) """ name = 'SORT' #if not name in self.capabilities: # Let the server decide! # raise self.error('unimplemented extension command: %s' % name) if (sort_criteria[0],sort_criteria[-1]) != ('(',')'): sort_criteria = '(%s)' % sort_criteria typ, dat = self._simple_command(name, sort_criteria, charset, *search_criteria) return self._untagged_response(typ, dat, name) def status(self, mailbox, names): """Request named status conditions for mailbox. (typ, [data]) = <instance>.status(mailbox, names) """ name = 'STATUS' #if self.PROTOCOL_VERSION == 'IMAP4': # Let the server decide! # raise self.error('%s unimplemented in IMAP4 (obtain IMAP4rev1 server, or re-code)' % name) typ, dat = self._simple_command(name, mailbox, names) return self._untagged_response(typ, dat, name) def store(self, message_set, command, flags): """Alters flag dispositions for messages in mailbox. (typ, [data]) = <instance>.store(message_set, command, flags) """ if (flags[0],flags[-1]) != ('(',')'): flags = '(%s)' % flags # Avoid quoting the flags typ, dat = self._simple_command('STORE', message_set, command, flags) return self._untagged_response(typ, dat, 'FETCH') def subscribe(self, mailbox): """Subscribe to new mailbox. (typ, [data]) = <instance>.subscribe(mailbox) """ return self._simple_command('SUBSCRIBE', mailbox) def thread(self, threading_algorithm, charset, *search_criteria): """IMAPrev1 extension THREAD command. (type, [data]) = <instance>.thread(threading_algorithm, charset, search_criteria, ...) """ name = 'THREAD' typ, dat = self._simple_command(name, threading_algorithm, charset, *search_criteria) return self._untagged_response(typ, dat, name) def uid(self, command, *args): """Execute "command arg ..." with messages identified by UID, rather than message number. (typ, [data]) = <instance>.uid(command, arg1, arg2, ...) Returns response appropriate to 'command'. """ command = command.upper() if not command in Commands: raise self.error("Unknown IMAP4 UID command: %s" % command) if self.state not in Commands[command]: raise self.error("command %s illegal in state %s, " "only allowed in states %s" % (command, self.state, ', '.join(Commands[command]))) name = 'UID' typ, dat = self._simple_command(name, command, *args) if command in ('SEARCH', 'SORT', 'THREAD'): name = command else: name = 'FETCH' return self._untagged_response(typ, dat, name) def unsubscribe(self, mailbox): """Unsubscribe from old mailbox. (typ, [data]) = <instance>.unsubscribe(mailbox) """ return self._simple_command('UNSUBSCRIBE', mailbox) def xatom(self, name, *args): """Allow simple extension commands notified by server in CAPABILITY response. Assumes command is legal in current state. (typ, [data]) = <instance>.xatom(name, arg, ...) Returns response appropriate to extension command `name'. """ name = name.upper() #if not name in self.capabilities: # Let the server decide! # raise self.error('unknown extension command: %s' % name) if not name in Commands: Commands[name] = (self.state,) return self._simple_command(name, *args) # Private methods def _append_untagged(self, typ, dat): if dat is None: dat = '' ur = self.untagged_responses if __debug__: if self.debug >= 5: self._mesg('untagged_responses[%s] %s += ["%s"]' % (typ, len(ur.get(typ,'')), dat)) if typ in ur: ur[typ].append(dat) else: ur[typ] = [dat] def _check_bye(self): bye = self.untagged_responses.get('BYE') if bye: raise self.abort(bye[-1]) def _command(self, name, *args): if self.state not in Commands[name]: self.literal = None raise self.error("command %s illegal in state %s, " "only allowed in states %s" % (name, self.state, ', '.join(Commands[name]))) for typ in ('OK', 'NO', 'BAD'): if typ in self.untagged_responses: del self.untagged_responses[typ] if 'READ-ONLY' in self.untagged_responses \ and not self.is_readonly: raise self.readonly('mailbox status changed to READ-ONLY') tag = self._new_tag() data = '%s %s' % (tag, name) for arg in args: if arg is None: continue if isinstance(arg, basestring) and _control_chars.search(arg): raise ValueError("Control characters not allowed in commands") data = '%s %s' % (data, self._checkquote(arg)) literal = self.literal if literal is not None: self.literal = None if type(literal) is type(self._command): literator = literal else: literator = None data = '%s {%s}' % (data, len(literal)) if __debug__: if self.debug >= 4: self._mesg('> %s' % data) else: self._log('> %s' % data) try: self.send('%s%s' % (data, CRLF)) except (socket.error, OSError), val: raise self.abort('socket error: %s' % val) if literal is None: return tag while 1: # Wait for continuation response while self._get_response(): if self.tagged_commands[tag]: # BAD/NO? return tag # Send literal if literator: literal = literator(self.continuation_response) if __debug__: if self.debug >= 4: self._mesg('write literal size %s' % len(literal)) try: self.send(literal) self.send(CRLF) except (socket.error, OSError), val: raise self.abort('socket error: %s' % val) if not literator: break return tag def _command_complete(self, name, tag): # BYE is expected after LOGOUT if name != 'LOGOUT': self._check_bye() try: typ, data = self._get_tagged_response(tag) except self.abort, val: raise self.abort('command: %s => %s' % (name, val)) except self.error, val: raise self.error('command: %s => %s' % (name, val)) if name != 'LOGOUT': self._check_bye() if typ == 'BAD': raise self.error('%s command error: %s %s' % (name, typ, data)) return typ, data def _get_response(self): # Read response and store. # # Returns None for continuation responses, # otherwise first response line received. resp = self._get_line() # Command completion response? if self._match(self.tagre, resp): tag = self.mo.group('tag') if not tag in self.tagged_commands: raise self.abort('unexpected tagged response: %s' % resp) typ = self.mo.group('type') dat = self.mo.group('data') self.tagged_commands[tag] = (typ, [dat]) else: dat2 = None # '*' (untagged) responses? if not self._match(Untagged_response, resp): if self._match(Untagged_status, resp): dat2 = self.mo.group('data2') if self.mo is None: # Only other possibility is '+' (continuation) response... if self._match(Continuation, resp): self.continuation_response = self.mo.group('data') return None # NB: indicates continuation raise self.abort("unexpected response: '%s'" % resp) typ = self.mo.group('type') dat = self.mo.group('data') if dat is None: dat = '' # Null untagged response if dat2: dat = dat + ' ' + dat2 # Is there a literal to come? while self._match(Literal, dat): # Read literal direct from connection. size = int(self.mo.group('size')) if __debug__: if self.debug >= 4: self._mesg('read literal size %s' % size) data = self.read(size) # Store response with literal as tuple self._append_untagged(typ, (dat, data)) # Read trailer - possibly containing another literal dat = self._get_line() self._append_untagged(typ, dat) # Bracketed response information? if typ in ('OK', 'NO', 'BAD') and self._match(Response_code, dat): self._append_untagged(self.mo.group('type'), self.mo.group('data')) if __debug__: if self.debug >= 1 and typ in ('NO', 'BAD', 'BYE'): self._mesg('%s response: %s' % (typ, dat)) return resp def _get_tagged_response(self, tag): while 1: result = self.tagged_commands[tag] if result is not None: del self.tagged_commands[tag] return result # Some have reported "unexpected response" exceptions. # Note that ignoring them here causes loops. # Instead, send me details of the unexpected response and # I'll update the code in `_get_response()'. try: self._get_response() except self.abort, val: if __debug__: if self.debug >= 1: self.print_log() raise def _get_line(self): line = self.readline() if not line: raise self.abort('socket error: EOF') # Protocol mandates all lines terminated by CRLF if not line.endswith('\r\n'): raise self.abort('socket error: unterminated line') line = line[:-2] if __debug__: if self.debug >= 4: self._mesg('< %s' % line) else: self._log('< %s' % line) return line def _match(self, cre, s): # Run compiled regular expression match method on 's'. # Save result, return success. self.mo = cre.match(s) if __debug__: if self.mo is not None and self.debug >= 5: self._mesg("\tmatched r'%s' => %r" % (cre.pattern, self.mo.groups())) return self.mo is not None def _new_tag(self): tag = '%s%s' % (self.tagpre, self.tagnum) self.tagnum = self.tagnum + 1 self.tagged_commands[tag] = None return tag def _checkquote(self, arg): # Must quote command args if non-alphanumeric chars present, # and not already quoted. if type(arg) is not type(''): return arg if len(arg) >= 2 and (arg[0],arg[-1]) in (('(',')'),('"','"')): return arg if arg and self.mustquote.search(arg) is None: return arg return self._quote(arg) def _quote(self, arg): arg = arg.replace('\\', '\\\\') arg = arg.replace('"', '\\"') return '"%s"' % arg def _simple_command(self, name, *args): return self._command_complete(name, self._command(name, *args)) def _untagged_response(self, typ, dat, name): if typ == 'NO': return typ, dat if not name in self.untagged_responses: return typ, [None] data = self.untagged_responses.pop(name) if __debug__: if self.debug >= 5: self._mesg('untagged_responses[%s] => %s' % (name, data)) return typ, data if __debug__: def _mesg(self, s, secs=None): if secs is None: secs = time.time() tm = time.strftime('%M:%S', time.localtime(secs)) sys.stderr.write(' %s.%02d %s\n' % (tm, (secs*100)%100, s)) sys.stderr.flush() def _dump_ur(self, dict): # Dump untagged responses (in `dict'). l = dict.items() if not l: return t = '\n\t\t' l = map(lambda x:'%s: "%s"' % (x[0], x[1][0] and '" "'.join(x[1]) or ''), l) self._mesg('untagged responses dump:%s%s' % (t, t.join(l))) def _log(self, line): # Keep log of last `_cmd_log_len' interactions for debugging. self._cmd_log[self._cmd_log_idx] = (line, time.time()) self._cmd_log_idx += 1 if self._cmd_log_idx >= self._cmd_log_len: self._cmd_log_idx = 0 def print_log(self): self._mesg('last %d IMAP4 interactions:' % len(self._cmd_log)) i, n = self._cmd_log_idx, self._cmd_log_len while n: try: self._mesg(*self._cmd_log[i]) except: pass i += 1 if i >= self._cmd_log_len: i = 0 n -= 1 try: import ssl except ImportError: pass else: class IMAP4_SSL(IMAP4): """IMAP4 client class over SSL connection Instantiate with: IMAP4_SSL([host[, port[, keyfile[, certfile]]]]) host - host's name (default: localhost); port - port number (default: standard IMAP4 SSL port). keyfile - PEM formatted file that contains your private key (default: None); certfile - PEM formatted certificate chain file (default: None); for more documentation see the docstring of the parent class IMAP4. """ def __init__(self, host = '', port = IMAP4_SSL_PORT, keyfile = None, certfile = None): self.keyfile = keyfile self.certfile = certfile IMAP4.__init__(self, host, port) def open(self, host = '', port = IMAP4_SSL_PORT): """Setup connection to remote server on "host:port". (default: localhost:standard IMAP4 SSL port). This connection will be used by the routines: read, readline, send, shutdown. """ self.host = host self.port = port self.sock = socket.create_connection((host, port)) self.sslobj = ssl.wrap_socket(self.sock, self.keyfile, self.certfile) self.file = self.sslobj.makefile('rb') def read(self, size): """Read 'size' bytes from remote.""" return self.file.read(size) def readline(self): """Read line from remote.""" return self.file.readline() def send(self, data): """Send data to remote.""" bytes = len(data) while bytes > 0: sent = self.sslobj.write(data) if sent == bytes: break # avoid copy data = data[sent:] bytes = bytes - sent def shutdown(self): """Close I/O established in "open".""" self.file.close() self.sock.close() def socket(self): """Return socket instance used to connect to IMAP4 server. socket = <instance>.socket() """ return self.sock def ssl(self): """Return SSLObject instance used to communicate with the IMAP4 server. ssl = ssl.wrap_socket(<instance>.socket) """ return self.sslobj __all__.append("IMAP4_SSL") class IMAP4_stream(IMAP4): """IMAP4 client class over a stream Instantiate with: IMAP4_stream(command) where "command" is a string that can be passed to subprocess.Popen() for more documentation see the docstring of the parent class IMAP4. """ def __init__(self, command): self.command = command IMAP4.__init__(self) def open(self, host = None, port = None): """Setup a stream connection. This connection will be used by the routines: read, readline, send, shutdown. """ self.host = None # For compatibility with parent class self.port = None self.sock = None self.file = None self.process = subprocess.Popen(self.command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, close_fds=True) self.writefile = self.process.stdin self.readfile = self.process.stdout def read(self, size): """Read 'size' bytes from remote.""" return self.readfile.read(size) def readline(self): """Read line from remote.""" return self.readfile.readline() def send(self, data): """Send data to remote.""" self.writefile.write(data) self.writefile.flush() def shutdown(self): """Close I/O established in "open".""" self.readfile.close() self.writefile.close() self.process.wait() class _Authenticator: """Private class to provide en/decoding for base64-based authentication conversation. """ def __init__(self, mechinst): self.mech = mechinst # Callable object to provide/process data def process(self, data): ret = self.mech(self.decode(data)) if ret is None: return '*' # Abort conversation return self.encode(ret) def encode(self, inp): # # Invoke binascii.b2a_base64 iteratively with # short even length buffers, strip the trailing # line feed from the result and append. "Even" # means a number that factors to both 6 and 8, # so when it gets to the end of the 8-bit input # there's no partial 6-bit output. # oup = '' while inp: if len(inp) > 48: t = inp[:48] inp = inp[48:] else: t = inp inp = '' e = binascii.b2a_base64(t) if e: oup = oup + e[:-1] return oup def decode(self, inp): if not inp: return '' return binascii.a2b_base64(inp) Mon2num = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12} def Internaldate2tuple(resp): """Parse an IMAP4 INTERNALDATE string. Return corresponding local time. The return value is a time.struct_time instance or None if the string has wrong format. """ mo = InternalDate.match(resp) if not mo: return None mon = Mon2num[mo.group('mon')] zonen = mo.group('zonen') day = int(mo.group('day')) year = int(mo.group('year')) hour = int(mo.group('hour')) min = int(mo.group('min')) sec = int(mo.group('sec')) zoneh = int(mo.group('zoneh')) zonem = int(mo.group('zonem')) # INTERNALDATE timezone must be subtracted to get UT zone = (zoneh*60 + zonem)*60 if zonen == '-': zone = -zone tt = (year, mon, day, hour, min, sec, -1, -1, -1) utc = time.mktime(tt) # Following is necessary because the time module has no 'mkgmtime'. # 'mktime' assumes arg in local timezone, so adds timezone/altzone. lt = time.localtime(utc) if time.daylight and lt[-1]: zone = zone + time.altzone else: zone = zone + time.timezone return time.localtime(utc - zone) def Int2AP(num): """Convert integer to A-P string representation.""" val = ''; AP = 'ABCDEFGHIJKLMNOP' num = int(abs(num)) while num: num, mod = divmod(num, 16) val = AP[mod] + val return val def ParseFlags(resp): """Convert IMAP4 flags response to python tuple.""" mo = Flags.match(resp) if not mo: return () return tuple(mo.group('flags').split()) def Time2Internaldate(date_time): """Convert date_time to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'. The date_time argument can be a number (int or float) representing seconds since epoch (as returned by time.time()), a 9-tuple representing local time (as returned by time.localtime()), or a double-quoted string. In the last case, it is assumed to already be in the correct format. """ if isinstance(date_time, (int, float)): tt = time.localtime(date_time) elif isinstance(date_time, (tuple, time.struct_time)): tt = date_time elif isinstance(date_time, str) and (date_time[0],date_time[-1]) == ('"','"'): return date_time # Assume in correct format else: raise ValueError("date_time not of a known type") dt = time.strftime("%d-%b-%Y %H:%M:%S", tt) if dt[0] == '0': dt = ' ' + dt[1:] if time.daylight and tt[-1]: zone = -time.altzone else: zone = -time.timezone return '"' + dt + " %+03d%02d" % divmod(zone//60, 60) + '"' if __name__ == '__main__': # To test: invoke either as 'python imaplib.py [IMAP4_server_hostname]' # or 'python imaplib.py -s "rsh IMAP4_server_hostname exec /etc/rimapd"' # to test the IMAP4_stream class import getopt, getpass try: optlist, args = getopt.getopt(sys.argv[1:], 'd:s:') except getopt.error, val: optlist, args = (), () stream_command = None for opt,val in optlist: if opt == '-d': Debug = int(val) elif opt == '-s': stream_command = val if not args: args = (stream_command,) if not args: args = ('',) host = args[0] USER = getpass.getuser() PASSWD = getpass.getpass("IMAP password for %s on %s: " % (USER, host or "localhost")) test_mesg = 'From: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s' % {'user':USER, 'lf':'\n'} test_seq1 = ( ('login', (USER, PASSWD)), ('create', ('/tmp/xxx 1',)), ('rename', ('/tmp/xxx 1', '/tmp/yyy')), ('CREATE', ('/tmp/yyz 2',)), ('append', ('/tmp/yyz 2', None, None, test_mesg)), ('list', ('/tmp', 'yy*')), ('select', ('/tmp/yyz 2',)), ('search', (None, 'SUBJECT', 'test')), ('fetch', ('1', '(FLAGS INTERNALDATE RFC822)')), ('store', ('1', 'FLAGS', '(\Deleted)')), ('namespace', ()), ('expunge', ()), ('recent', ()), ('close', ()), ) test_seq2 = ( ('select', ()), ('response',('UIDVALIDITY',)), ('uid', ('SEARCH', 'ALL')), ('response', ('EXISTS',)), ('append', (None, None, None, test_mesg)), ('recent', ()), ('logout', ()), ) def run(cmd, args): M._mesg('%s %s' % (cmd, args)) typ, dat = getattr(M, cmd)(*args) M._mesg('%s => %s %s' % (cmd, typ, dat)) if typ == 'NO': raise dat[0] return dat try: if stream_command: M = IMAP4_stream(stream_command) else: M = IMAP4(host) if M.state == 'AUTH': test_seq1 = test_seq1[1:] # Login not needed M._mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION) M._mesg('CAPABILITIES = %r' % (M.capabilities,)) for cmd,args in test_seq1: run(cmd, args) for ml in run('list', ('/tmp/', 'yy%')): mo = re.match(r'.*"([^"]+)"$', ml) if mo: path = mo.group(1) else: path = ml.split()[-1] run('delete', (path,)) for cmd,args in test_seq2: dat = run(cmd, args) if (cmd,args) != ('uid', ('SEARCH', 'ALL')): continue uid = dat[-1].split() if not uid: continue run('uid', ('FETCH', '%s' % uid[-1], '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)')) print '\nAll tests OK.' except: print '\nTests failed.' if not Debug: print ''' If you would like to see debugging output, try: %s -d5 ''' % sys.argv[0] raise
Save