Python规范

最近更新时间:2018-05-10 18:00:00


Python脚本开发者注意事项

  • 支持提交单个py脚本或者zip/tar.gz压缩包
  • 压缩包顶层需要有main.py,平台只会执行这个文件
  • 压缩包体积不可超过1M,解压后不可超过100M
  • 压缩包不可包含dll、so等二进制程序
  • 脚本(或者压缩包内容经解压后)在节点上存放的目录本身是只读的。若程序需要写磁盘,请写在/tmp目录下,可用磁盘空间为10MB
  • 我们为每一个节点生成了一个独一无二的字符串id以便开发者区分脚本运行的宿主,可在/tmp/node_id文件读取

Python版本

目前支持Python 2.7.13

可调用的程序(位于$PATH中,可直接调用)

程序名 说明
fping fping 4.0 http://fping.org/

Python可用库列表

__builtin__ __future__ _abcoll _ast _bisect
_bsddb _codecs _collections _csv _ctypes
_curses _elementtree _functools _hashlib _heapq
_hotshot _io _json _locale _lsprof
_LWPCookieJar _markerlib _MozillaCookieJar _multibytecodec _multiprocessing
_pyio _random _socket _sqlite3 _sre
_ssl _strptime _struct _symtable _sysconfigdata
_testcapi _tevent _warnings _weakref _weakrefset
abc aifc antigravity anydbm argparse
array arrow ast asynchat asyncore
atexit attr audiodev audioop base64
BaseHTTPServer Bastion bdb binascii binhex
bisect bitstring bs4 bsddb bz2
calendar CDROM cffi cffibackend cgi
CGIHTTPServer cgitb characteristic chardet chunk
cmath cmd code codec codecs
codecscn codecshk codecsiso2022 codecsjp codecskr
codecstw codeop collections colorsys commands
compat compileall compiler ConfigParser contextlib
Cookie cookielib copy copy_reg cPickle
cProfile crc16 crcmod crypt Crypto
cryptography cssselect cssutils cStringIO csv
ctypes ctypestest curses cursespanel dataproperty
datetime dateutil dbhash decimal difflib
dircache dis distutils DLFCN doctest
DocXMLRPCServer dominate dumbdbm dummy_thread dummy_threading
easy_install email encodings encutils ensurepip
enum errno exceptions fcntl filecmp
fileinput fnmatch formatter fpformat fractions
ftplib functools future_builtins gc genericpath
getopt getpass gettext glob grp
gzip hashlib heapq hmac hotshot
html5lib htmlentitydefs htmllib HTMLParser httplib
httplib2 humanize idna ihooks imaplib
imghdr imp importlib imputil IN
inspect io ipaddress itertools json
jsonschema jsonschemavalidator keyring keyword kmod
ldb ldbtext libmount linecache locale
logbook logging lxml macpath macurl2path
mailbox mailcap markdown2 markupbase marshal
math mbstrdecoder md5 mhlib mimetools
mimetypes MimeWriter mimify mmap modulefinder
multifile multiprocessing mutex netaddr netifaces
netrc new nntplib ntpath nturl2path
numbers opcode OpenSSL operator optparse
os os2emxpath osxsupport parser path
pathvalidate pdb pickle pickletools pipes
pkcs7 pkg_resources pkgutil platform plistlib
popen2 poplib posix posix_ipc posixfile
posixpath pprint profile pstats pty
ptyprocess pwd py_compile pyasn1 pyclbr
pydoc pyexpat pyinotify pyparsing pytablereader
pytablewriter pytz Queue quopri random
re readline repr requests resource
rexec rfc822 rlcompleter robotparser runpy
sched select selenium sets setuptools
sgmllib sha shelve shlex shutil
signal SimpleHTTPServer simplejson SimpleXMLRPCServer site
six smtpd smtplib sndhdr socket
SocketServer spwd sqlite3 sre sre_compile
sre_constants sre_parse ssl stat statvfs
string StringIO stringold stringprep strop
struct subprocess sunau sunaudio symbol
symtable sys sysconfig syslog tabnanny
talloc tarfile tdb tdbtext telnetlib
tempfile termios test_characteristic test_path tevent
textwrap this thread threading threadinglocal
time timeit toaiff token tokenize
toml trace traceback tty type
TYPES types ubjson ujson unicodedata
unittest urllib urllib2 urlparse user
UserDict UserList UserString uu uuid
versiontools warnings wave weakref web
webbrowser whichdb wsgiref xdrlib xlrd
xlsxwriter xlutils xlwt xml xmllib
xmlrpclib xxsubtype zipfile zipimport zlib