{ "info": { "author": "AMM", "author_email": "the.actual.amm@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only" ], "description": "YABEncode - Yet Another Bencode module\n======================================\n\nAn implementation of bencoding/bdecoding in Python 3, with somewhat descriptive\nExceptions for decode errors.\nAlso includes a command-line tool for decoding and pretty-printing bencoded data!\n\nInstalling\n------------------\n\nTo install from `PyPI `_:\n\n.. code-block:: bash\n\n pip install yabencode\n\n----\n\nUsage:\n######\n\nIn Python...\n\n.. code-block:: python\n\n import yabencode\n # bencode supports dicts, lists, ints and strings (bytestrings)\n yabencode.encode({'foo':'baz', 'list':['eggs', 'spam', 'bacon']})\n # Input can be string, bytes or a file object\n yabencode.decode(b'd3:foo3:baz4:listl4:eggs4:spam5:baconee')\n\n try:\n # Malformed data, 'spam' is missing an 'a'\n yabencode.decode(b'd3:foo3:baz4:listl4:eggs4:spm5:baconee')\n except yabencode.MalformedBencodeException as e:\n print(e)\n # Unexpected data type (b':') at position 31 (0x1F hex)\n\n try:\n # Bencode does not support floats\n yabencode.encode({'float':3.14})\n except yabencode.BencodeException as e:\n print(e)\n # Unsupported type \n\nor with the command-line tool:\n\n.. code-block:: bash\n\n $ yabencode -h\n usage: yabencode [-h] [-t KEY] [-r] FILE\n\n Bdecode a file/standard input and pretty-print the resulting data\n\n positional arguments:\n FILE Input file. Use - for stdin\n\n optional arguments:\n -h, --help show this help message and exit\n -t KEY, --truncate KEY\n Truncate values under given key. May be repeated for\n multiple values\n -r, --raw Raw keys - do not decode dictionary keys\n\n $ # The 'pieces'-bytestring is rather long, so let's truncate it\n $ yabencode -t pieces ubuntu-17.04-desktop-amd64.iso.torrent\n {'announce': b'http://torrent.ubuntu.com:6969/announce',\n 'announce-list': [[b'http://torrent.ubuntu.com:6969/announce'],\n [b'http://ipv6.torrent.ubuntu.com:6969/announce']],\n 'comment': b'Ubuntu CD releases.ubuntu.com',\n 'creation date': 1492077159,\n 'info': {'length': 1609039872,\n 'name': b'ubuntu-17.04-desktop-amd64.iso',\n 'piece length': 524288,\n 'pieces': ''}}\n\n $ # Reading bytes from stdin (using -r to not decode the keys)\n $ curl -s 'http://torrent.ubuntu.com:6969/scrape?info_hash=%59%06%67%69%b9%ad%42%da%2e%50%86%11%c3%3d%7c%44%80%b3%85%7b' | yabencode -r -\n {b'files': {b'Y\\x06gi\\xb9\\xadB\\xda.P\\x86\\x11\\xc3=|D\\x80\\xb3\\x85{': {b'complete': 3473,\n b'downloaded': 33029,\n b'incomplete': 102,\n b'name': b'ubuntu-17.04-desktop-amd64.iso'}}}\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/TheAMM/YABEncode", "keywords": "bencode bdecode torrent bencoding", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "yabencode", "package_url": "https://pypi.org/project/yabencode/", "platform": "", "project_url": "https://pypi.org/project/yabencode/", "project_urls": { "Homepage": "https://github.com/TheAMM/YABEncode" }, "release_url": "https://pypi.org/project/yabencode/0.2.0/", "requires_dist": null, "requires_python": ">=3.3, <4", "summary": "YABEncode - Yet Another Bencode module", "version": "0.2.0" }, "last_serial": 3191768, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "620983e39d5e359a2c61be672323d9a9", "sha256": "9ae6b9211fd5a2b8212d55a3e1e58cc17791bd8e869c9b6541a9332abb3cdde8" }, "downloads": -1, "filename": "yabencode-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "620983e39d5e359a2c61be672323d9a9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.3, <4", "size": 5019, "upload_time": "2017-09-10T14:38:08", "url": "https://files.pythonhosted.org/packages/f1/4b/2779d719a9c7d54b3a96e6ec5b2e7ab5bb72f58d979d8d0f3f3ca7711051/yabencode-0.1.0-py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "5990d18bb9e138a576085a4799ef5702", "sha256": "8f674892904417f9aab00a68a38482f796ca2765371ce31e4740b1e928ac77ae" }, "downloads": -1, "filename": "yabencode-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5990d18bb9e138a576085a4799ef5702", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.3, <4", "size": 7982, "upload_time": "2017-09-21T14:00:07", "url": "https://files.pythonhosted.org/packages/cb/84/5f614d356e3ffebdbb51ae1ca90160ab9c36d19a83449c2b48bc108ad67a/yabencode-0.2.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5990d18bb9e138a576085a4799ef5702", "sha256": "8f674892904417f9aab00a68a38482f796ca2765371ce31e4740b1e928ac77ae" }, "downloads": -1, "filename": "yabencode-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5990d18bb9e138a576085a4799ef5702", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.3, <4", "size": 7982, "upload_time": "2017-09-21T14:00:07", "url": "https://files.pythonhosted.org/packages/cb/84/5f614d356e3ffebdbb51ae1ca90160ab9c36d19a83449c2b48bc108ad67a/yabencode-0.2.0-py3-none-any.whl" } ] }