您知道使用Bittorent发送/接收文件的Python库吗?

您知道使用Bittorent发送/接收文件的Python库吗?,python,bittorrent,Python,Bittorrent,我有大文件要转移到很多服务器上。现在我们使用rsync,但我想尝试一下bittorent 我正在学习Pluge的代码,这是一个Python bittorent客户端,但它使用twisted,非常复杂。你知道什么高级的东西吗 编辑:我刚刚读到Facebook使用Bittorent进行代码部署。也许他们出版了他们的图书馆,但我找不到。听说过吗?最初的BitTorrent客户端是用Python编写的。你查过了吗?我绝对推荐。它是一个带有Python绑定的C++库。同样的一个为洪水、传输、Miro和许多

我有大文件要转移到很多服务器上。现在我们使用rsync,但我想尝试一下bittorent

我正在学习Pluge的代码,这是一个Python bittorent客户端,但它使用twisted,非常复杂。你知道什么高级的东西吗


编辑:我刚刚读到Facebook使用Bittorent进行代码部署。也许他们出版了他们的图书馆,但我找不到。听说过吗?

最初的BitTorrent客户端是用Python编写的。你查过了吗?

我绝对推荐。它是一个带有Python绑定的C++库。同样的一个为洪水、传输、Miro和许多其他bittorrent客户端提供动力

与另一个libtorrent(rTorrent项目的一部分)不同,这个libtorrent正在积极开发中,支持所有现代协议扩展,如DHT、元数据传输,甚至支持一些专有的uTorrent扩展,如对等交换(PEX)

API有很好的文档记录

从下面的全功能简单客户机示例中可以看出,您不需要了解底层协议的每一点(当然,这样做会有很大帮助):


p.S.Facebook有一个专门的页面,用于他们的开源项目。没有列出bittorrent实现。

可能会有所帮助。它是围绕C++ LIB库的一个Python包装器,它被包含在洪水工程中,现在被绘制成1000行代码,没有食谱。它离高度非常远。如果你不知道协议,你就被卡住了。
#!/bin/python
# Copyright Arvid Norberg 2008. Use, modification and distribution is
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


import libtorrent as lt
import time
import sys

ses = lt.session()
ses.listen_on(6881, 6891)

info = lt.torrent_info(sys.argv[1])
h = ses.add_torrent({'ti': info, 'save_path': './'})
print 'starting', h.name()

while (not h.is_seed()):
    s = h.status()

    state_str = ['queued', 'checking', 'downloading metadata', 'downloading', \
        'finished', 'seeding', 'allocating', 'checking fastresume']
    print '\r%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \
        (s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, \
        s.num_peers, state_str[s.state]),
    sys.stdout.flush()

    time.sleep(1)

print h.name(), 'complete'