Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Small library for encoding/decoding bencode data. Pyben Enables fast and easy encoding and decoding of bencoded data.
Small library for encoding/decoding bencode data. Supports Unicode pathnames as of PyBen 3.0. Pyben Enables fast and easy encoding and decoding of bencoded data.
Python v3.6+
To install PyBen, follow these steps:
Using pip:
pip install pyben
Using git:
git clone https://github.com/alexpdev/pyben.git
The API is intentionally designed to mimic Python's json and pickle modules.
>>> import os
>>> import pyben
>>> file_path = "path/to/encoded.file"
>>> data = {"item1": ["item2", 3, [4], {5: "item6"}]}
>>> encoded = pyben.dumps(data)
>>> encoded
... b'd5:item1l5:item2i3eli4eedi5e5:item6eee'
>>> decoded = pyben.loads(encoded)
>>> decoded
... {'item1': ['item2', 3, [4], {5: 'item6'}]}
>>> decoded == data
... True
One key difference is that the 'load' and 'dump' methods accept as arguments, string paths or path-like objects as well as an open BytesIO object.
For Example this:
>>> with open(file_path, "wb") as fd:
>>> pyben.dump(decoded, fd)
>>> os.path.exists(file_path)
... True
>>> with open(file_path, "rb") as fd:
>>> decoded_file = pyben.load(fd)
>>> decoded_file == decoded == data
... True
is the same as doing following.
>>> pyben.dump(data, file_path)
>>> os.path.exists(file_path)
... True
>>> decoded_file = pyben.load(file_path)
>>> decoded_file == decoded == data
... True
The full API includes many other functions and classes as well. See docs for more full API.
This project uses the following license: Apache 2.0
FAQs
Small library for encoding/decoding bencode data. Pyben Enables fast and easy encoding and decoding of bencoded data.
We found that pyben demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.