https://github.com/purplesyringa/bencode-open
Open-source MIT-licensed library for parsing and converting objects to and from bencode format
https://github.com/purplesyringa/bencode-open
bencode bencode-parser mit-license
Last synced: about 1 month ago
JSON representation
Open-source MIT-licensed library for parsing and converting objects to and from bencode format
- Host: GitHub
- URL: https://github.com/purplesyringa/bencode-open
- Owner: purplesyringa
- License: mit
- Created: 2019-11-02T18:24:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-17T08:50:25.000Z (over 5 years ago)
- Last Synced: 2025-03-09T18:37:14.489Z (2 months ago)
- Topics: bencode, bencode-parser, mit-license
- Language: Python
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bencode
`bencode-open` is an open-source MIT-licensed library for parsing and converting
objects to and from [Bencode format](https://en.wikipedia.org/wiki/Bencode).## Rationale
`bencode-open` is MIT-licensed and can thus be included to almost all software,
compared to `bencode` and `bencode.py`.## Installation
`bencode-open` is available on [GitHub](https://github.com/imachug/bencode-open)
and on [PyPI](https://pypi.org/project/bencode-open/).Installing `bencode-open` from PyPI is recommended and can be done as follows:
```
pip install bencode-open
```## Usage
```python
import bencode_openprint(bencode_open.dumps(b"Hello?")) # Outputs b"6:Hello?"
print(bencode_open.dumps(17)) # Outputs b"i17e"print(bencode_open.loads(b"6:Hello?")) # Outputs b"Hello?"
print(bencode_open.loads(b"i17e")) # Outputs 17
```## Running tests
```
python test.py
```