Skip to main content

torrent文件的编码、解码

Project description

TorrentBEncode3

用于编码、解码torrent文件的bencode格式, 需要Python3.5+

安装

pip3 install torrent-bencode3

测试

  1. git clone https://github.com/skytoup/TorrentBEncode3
  2. cd TorrentBEncode3
  3. pip3 install -r requirements-test.txt
  4. tox

使用

from bencode import dumps, loads, dump, load


s = loads(b'11:hello world')  # b'hello world'
dumps(s)  # b'11:hello world'

with open('/path/to/torrent', 'rb') as f:
    obj = load(f)
    with open('/path/to/save/torrent', 'wb') as wf:
        dump(obj, wf)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torrent-bencode3-0.1.1.tar.gz (4.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page