非常快速的异步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第三方库


热门话题
jframe为什么JAVA paint()方法不起作用?   java Guice:将ContainerRequestContext注入拦截器   java如何优雅地关闭Spring JMS MessageListenerAdapter   java如何在Spring中设置快照隔离级别   Java中的安卓平台独立信任存储路径   java无法在eclipse中运行hello world程序   java Sinch空指针问题   使用Java将JSON流式传输到BigQuery   java从“大数据”中选择什么Swing控件?   java通过对象字段过滤/排序集合?   java将数据从活动传递到另一个活动中的片段   java访问打包在jar文件中的文档   Java获取事件的大小。getDragboard()。getFiles()。流()。映射(文件::长度)。toString());   java Android libgdx:启动程序图标按下后,启动屏幕不会立即显示   java如何在Google App Engine灵活环境中配置oracle jdk   java有没有办法减少这些行?   Java:客户端socket不读取第二行,在终止符行之后保持打开状态   java以编程方式获取api 29上的所有APK文件   java ActionBar按钮不显示