非常快速的异步ftp服务器库

pyftpdlib的Python项目详细描述


DownloadsLinux tests (Travis)Windows tests (Appveyor)Test coverage (coverall.io)Documentation StatusLatest versionGithub starsLicense

关于

python ftp服务器库提供了一个高级的可移植接口 使用python编写非常高效、可伸缩和异步的ftp服务器。它是 最完整的RFC-959ftp服务器 可用于Python编程的实现 语言和它在诸如 Google ChromiumBazaar并包含在 DebianFedoraFreeBSD包存储库。

功能

  • 非常lightweightfastscalable(请参阅 whybenchmarks)。
  • 使用sendfile(2)(请参阅pysendfile) 系统要求上传。
  • 使用epoll()/kqueue()/select()异步处理并发。
  • …但可以选择跳到 multiple thread / process 模型(如中所示:您可以自由地阻塞或使用慢文件系统)。
  • 可移植:完全用纯python编写;与python一起工作,从2.63.5使用单个代码基。
  • 支持ftpsRFC-4217), ^ {str 1}$ipv6(RFC-2428), unicode文件名(RFC-2640), mlsd/mlst命令(RFC-3659)。
  • 支持虚拟用户和虚拟文件系统。
  • 极灵活的“授权人”制度,既能管理“虚拟”又能管理“虚拟”。 “真实”用户 UNIXWindows
  • Test coverage 接近100%。

性能

尽管pyftpdlib是用intepreted语言编写的,但它有传输速率 优于大多数常见的unix ftp服务器。它的伸缩性也更好,因为 vsftpd和proftpd使用多个进程来实现并发,pyftpdlib 将只使用一个进程并异步处理并发(请参见 the C10K problem)。这里有一些 benchmarks 针对我的Linux 3.0.0系统,Intel Core Duo 3.1 GHz:

Pyftpdlib与Proftpd之比较1.3.4

benchmark typepyftpdlibproftpdspeedup
STOR (client -> server)585.90 MB/sec600.49 MB/sec-0.02x
RETR (server -> client)1652.72 MB/sec1524.05 MB/sec+0.08
300 concurrent clients (connect, login)0.19 secs9.98 secs+51x
STOR (1 file with 300 idle clients)585.59 MB/sec518.55 MB/sec+0.1x
RETR (1 file with 300 idle clients)1497.58 MB/sec1478.19 MB/sec0x
300 concurrent clients (RETR 10M file)3.41 secs3.60 secs+0.05x
300 concurrent clients (STOR 10M file)8.60 secs11.56 secs+0.3x
300 concurrent clients (QUIT)0.03 secs0.39 secs+12x

pyftpdlib与vsftpd 2.3.5

benchmark typepyftpdlibvsftpdspeedup
STOR (client -> server)585.90 MB/sec611.73 MB/sec-0.04x
RETR (server -> client)1652.72 MB/sec1512.92 MB/sec+0.09
300 concurrent clients (connect, login)0.19 secs20.39 secs+106x
STOR (1 file with 300 idle clients)585.59 MB/sec610.23 MB/sec-0.04x
RETR (1 file with 300 idle clients)1497.58 MB/sec1493.01 MB/sec0x
300 concurrent clients (RETR 10M file)3.41 secs3.67 secs+0.07x
300 concurrent clients (STOR 10M file)8.60 secs9.82 secs+0.07x
300 concurrent clients (QUIT)0.03 secs0.01 secs+0.14x

有关更多基准,请参见here

快速启动

>>>frompyftpdlib.authorizersimportDummyAuthorizer>>>frompyftpdlib.handlersimportFTPHandler>>>frompyftpdlib.serversimportFTPServer>>>>>>authorizer=DummyAuthorizer()>>>authorizer.add_user("user","12345","/home/giampaolo",perm="elradfmwMT")>>>authorizer.add_anonymous("/home/nobody")>>>>>>handler=FTPHandler>>>handler.authorizer=authorizer>>>>>>server=FTPServer(("127.0.0.1",21),handler)>>>server.serve_forever()[I13-02-1910:55:42]>>>startingFTPserveron127.0.0.1:21<<<[I13-02-1910:55:42]poller:<class'pyftpdlib.ioloop.Epoll'>[I13-02-1910:55:42]masquerade(NAT)address:None[I13-02-1910:55:42]passiveports:None[I13-02-1910:55:42]usesendfile(2):True[I13-02-1910:55:45]127.0.0.1:34178-[]FTPsessionopened(connect)[I13-02-1910:55:48]127.0.0.1:34178-[user]USER'user'loggedin.[I13-02-1910:56:27]127.0.0.1:34179-[user]RETR/home/giampaolo/.vimrccompleted=1bytes=1700seconds=0.001[I13-02-1910:56:39]127.0.0.1:34179-[user]FTPsessionclosed(disconnect).

other code samples

商标

采用pyftpdlib(complete list)的一些著名商标。

docs/images/chrome.jpgdocs/images/debian.pngdocs/images/fedora.pngdocs/images/freebsd.gifdocs/images/openerp.jpgdocs/images/bazaar.jpgdocs/images/bitsontherun.pngdocs/images/openvms.pngdocs/images/smartfile.png

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
javajaxb在嵌套节点中生成xmlns:xsi声明   java重定向到youtube以上传jsp上可用的视频   java提高了JVM和ANT的性能   java如何将返回的JSON数据放在HTML表单中   java如何发送XWWWFORMURLENCODE在重新授权   java为什么jvm XX:+EliminateAllocations失败   堆移除和重建方法?(爪哇)   Stanford NPL in Spark(Scala)应用程序运行到Java堆空间(Java.lang.OutOfMemoryError)   调试java中打开/关闭println的任何方式(详细模式)   java IntelliJ在鼠标悬停时显示JavaDocs工具提示   Olingo Odata Java中的自动扩展选项   json将postgres文本arry转换为java列表?   oop需要帮助推断Java代码   复选框的java添加操作侦听器AbstractTableModel   java如何从公共静态void main(String[]args)传递值   java从数据库中获取大值   java Processing 2.0电影从jar运行时无法打开电影文件   java如何在不使用应用程序的情况下刷新活动?   尝试将JSON解析为ListView时的Android:JSON parse:null对象引用