Name | pyben JSON |
Version |
0.3.2
JSON |
| download |
home_page | https://github.com/alexpdev/pyben |
Summary | Small library for encoding/decoding bencode data. Pyben Enables fast and easy encoding and decoding of bencoded data. |
upload_time | 2022-06-05 02:21:42 |
maintainer | |
docs_url | None |
author | alexpdev |
requires_python | |
license | Apache 2.0 |
keywords |
library
bencode
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Pyben v0.3.2
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.
![PyBen](./assets/pyben.png)
---------
![GitHub repo size](https://img.shields.io/github/repo-size/alexpdev/pyben?style=flat-square)
![GitHub contributors](https://img.shields.io/github/license/alexpdev/pyben)
![PyPI - Downloads](https://img.shields.io/pypi/dm/pyben?color=%23CC3919&label=PyPi%20Downloads&logo=PyPi&logoColor=cyan&style=flat-square)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/af86338dcf0a4a899228df470d20e894)](https://www.codacy.com/gh/alexpdev/pyben/dashboard?utm_source=github.com&utm_medium=referral&utm_content=alexpdev/pyben&utm_campaign=Badge_Grade)
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/af86338dcf0a4a899228df470d20e894)](https://www.codacy.com/gh/alexpdev/pyben/dashboard?utm_source=github.com&utm_medium=referral&utm_content=alexpdev/pyben&utm_campaign=Badge_Coverage)
[![codecov](https://codecov.io/gh/alexpdev/pyben/branch/master/graph/badge.svg?token=N6TCUUQ6CJ)](https://codecov.io/gh/alexpdev/pyben)
## Prerequisites
Python v3.6+
## Installing PyBen
To install PyBen, follow these steps:
Using pip:
`pip install pyben`
Using git:
`git clone https://github.com/alexpdev/pyben.git`
## Using PyBen
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.
## License
This project uses the following license: Apache 2.0
Raw data
{
"_id": null,
"home_page": "https://github.com/alexpdev/pyben",
"name": "pyben",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "library,bencode",
"author": "alexpdev",
"author_email": "alexpdev@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/ba/41/5eea56d283da685a2eb4e9529f2245f16a330af22fbadfddea51f8688a1b/pyben-0.3.2.tar.gz",
"platform": "any",
"description": "# Pyben v0.3.2\n\nSmall library for encoding/decoding bencode data.\nSupports Unicode pathnames as of PyBen 3.0.\nPyben Enables fast and easy encoding and decoding of bencoded data.\n\n![PyBen](./assets/pyben.png)\n\n---------\n\n![GitHub repo size](https://img.shields.io/github/repo-size/alexpdev/pyben?style=flat-square)\n![GitHub contributors](https://img.shields.io/github/license/alexpdev/pyben)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/pyben?color=%23CC3919&label=PyPi%20Downloads&logo=PyPi&logoColor=cyan&style=flat-square)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/af86338dcf0a4a899228df470d20e894)](https://www.codacy.com/gh/alexpdev/pyben/dashboard?utm_source=github.com&utm_medium=referral&utm_content=alexpdev/pyben&utm_campaign=Badge_Grade)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/af86338dcf0a4a899228df470d20e894)](https://www.codacy.com/gh/alexpdev/pyben/dashboard?utm_source=github.com&utm_medium=referral&utm_content=alexpdev/pyben&utm_campaign=Badge_Coverage)\n[![codecov](https://codecov.io/gh/alexpdev/pyben/branch/master/graph/badge.svg?token=N6TCUUQ6CJ)](https://codecov.io/gh/alexpdev/pyben)\n\n## Prerequisites\n\nPython v3.6+\n\n## Installing PyBen\n\nTo install PyBen, follow these steps:\n\nUsing pip:\n\n`pip install pyben`\n\nUsing git:\n\n`git clone https://github.com/alexpdev/pyben.git`\n\n## Using PyBen\n\nThe API is intentionally designed to mimic Python's json and pickle modules.\n\n >>> import os\n >>> import pyben\n >>> file_path = \"path/to/encoded.file\"\n >>> data = {\"item1\": [\"item2\", 3, [4], {5: \"item6\"}]}\n >>> encoded = pyben.dumps(data)\n >>> encoded\n ... b'd5:item1l5:item2i3eli4eedi5e5:item6eee'\n >>> decoded = pyben.loads(encoded)\n >>> decoded\n ... {'item1': ['item2', 3, [4], {5: 'item6'}]}\n >>> decoded == data\n ... True\n\nOne key difference is that the 'load' and 'dump' methods accept as arguments,\nstring paths or path-like objects as well as an open BytesIO object.\n\nFor Example this:\n\n >>> with open(file_path, \"wb\") as fd:\n >>> pyben.dump(decoded, fd)\n >>> os.path.exists(file_path)\n ... True\n >>> with open(file_path, \"rb\") as fd:\n >>> decoded_file = pyben.load(fd)\n >>> decoded_file == decoded == data\n ... True\n\nis the same as doing following.\n\n >>> pyben.dump(data, file_path)\n >>> os.path.exists(file_path)\n ... True\n >>> decoded_file = pyben.load(file_path)\n >>> decoded_file == decoded == data\n ... True\n\nThe full API includes many other functions and classes as well.\nSee docs for more full API.\n\n## License\n\nThis project uses the following license: Apache 2.0\n\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Small library for encoding/decoding bencode data. Pyben Enables fast and easy encoding and decoding of bencoded data.",
"version": "0.3.2",
"project_urls": {
"Homepage": "https://github.com/alexpdev/pyben",
"Source Code": "https://github.com/alexpdev/pyben"
},
"split_keywords": [
"library",
"bencode"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9688a9dee49a0ea8e9abb14c688a0a38dcde1c6670fb5ce0c8ed74ae0057f27b",
"md5": "fb2e5612e16d2ec3ba879d28f08a0053",
"sha256": "b3ed47ccfbaee443e268ac1a4721b8e211f282f45caa21eb0584cb3865789914"
},
"downloads": -1,
"filename": "pyben-0.3.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb2e5612e16d2ec3ba879d28f08a0053",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 15695,
"upload_time": "2022-06-05T02:21:41",
"upload_time_iso_8601": "2022-06-05T02:21:41.304493Z",
"url": "https://files.pythonhosted.org/packages/96/88/a9dee49a0ea8e9abb14c688a0a38dcde1c6670fb5ce0c8ed74ae0057f27b/pyben-0.3.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bc3fc47622637f8ecaf064d084e0e52cc2763f17d1439732c69433df37606c9f",
"md5": "7c26ed991acb8e1f69c2e252025e5362",
"sha256": "192cc709093b74038e82972d9592c6865acf23ad0f86b92fb9a787a53e0d5494"
},
"downloads": -1,
"filename": "pyben-0.3.2-py3.10.egg",
"has_sig": false,
"md5_digest": "7c26ed991acb8e1f69c2e252025e5362",
"packagetype": "bdist_egg",
"python_version": "0.3.2",
"requires_python": null,
"size": 22244,
"upload_time": "2022-06-05T02:21:44",
"upload_time_iso_8601": "2022-06-05T02:21:44.544261Z",
"url": "https://files.pythonhosted.org/packages/bc/3f/c47622637f8ecaf064d084e0e52cc2763f17d1439732c69433df37606c9f/pyben-0.3.2-py3.10.egg",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ba415eea56d283da685a2eb4e9529f2245f16a330af22fbadfddea51f8688a1b",
"md5": "023a674214f66d55e4513d2f3f4af864",
"sha256": "523eeebda9fbd30b523cac27d1eb83896f18599e7efee6a5319b682585f3ef78"
},
"downloads": -1,
"filename": "pyben-0.3.2.tar.gz",
"has_sig": false,
"md5_digest": "023a674214f66d55e4513d2f3f4af864",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 81104,
"upload_time": "2022-06-05T02:21:42",
"upload_time_iso_8601": "2022-06-05T02:21:42.727653Z",
"url": "https://files.pythonhosted.org/packages/ba/41/5eea56d283da685a2eb4e9529f2245f16a330af22fbadfddea51f8688a1b/pyben-0.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-06-05 02:21:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alexpdev",
"github_project": "pyben",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyben"
}