Metadata-Version: 2.1
Name: cpyberry-pybencode
Version: 2.0.1
Summary: Simple bencode library for python
Home-page: https://github.com/cpyberry/pybencode
Author: cpyberry
Author-email: cpyberry222@gmail.com
License: Apache-2.0 License
Description: # pybencode
        
        Simple bencode library for python
        
        ![license](https://shields.io/github/license/cpyberry/pybencode)
        
        ## Requirements
        
        * python 3.6, 3.7, 3.8, 3.9
        
        ## Installation
        
        ```shell
        pip install cpyberry-pybencode
        ```
        
        ## Usage
        
        ```python
        import pybencode
        
        
        pybencode.encode(256)  # return b"i256e"
        
        pybencode.encode(b"neko")  # return b"4:neko"
        
        pybencode.encode([1, 2, 3])  # return b"li1ei2ei3ee"
        
        pybencode.encode({1: b"kuro", 2: b"sakura"})
        # return b"di1e4:kuroi2e6:sakurae"
        
        ```
        
        Nested lists and dicts can also be encoded.
        
        ```python
        pybencode.encode([b"cat", 1024, [b"meow", b"woof"]])
        # return b"l3:cati1024el4:meow4:woofee"
        
        pybencode.encode({1: {b"yuki": b"ghost"}})
        # return b"di1ed4:yuki5:ghostee"
        ```
        
        Decode can do the opposite of the above.
        
        Similarly, you can decode nested list and dict.
        
        ```python
        pybencode.decode(b"5:night")  # return "night"
        pybencode.decode(b"i128e")  # return 128
        
        python.decode(b"di1ed4:yuki5:ghostee")
        # return {1: {b"yuki": b"ghost"}}
        
        python.decode(b"l3:cati1024el4:meow4:woofee")
        # return [b"cat", 1024, [b"meow", b"woof"]]
        ```
        
        If you want to encode the string to bencode format, you need to encode it with any character code first.
        
        For example
        
        ```python
        string = "coppelia"
        pybencode.encode(string.encode("latin-1"))
        ```
        
Keywords: bencode
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Natural Language :: Japanese
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.6
Description-Content-Type: text/markdown
