{"id":16027005,"url":"https://github.com/alexpdev/pyben","last_synced_at":"2025-03-18T03:32:03.528Z","repository":{"id":38389707,"uuid":"405253017","full_name":"alexpdev/pyben","owner":"alexpdev","description":"bencode library and python implementation, with identical API as the python's json module.","archived":false,"fork":false,"pushed_at":"2023-06-22T03:36:58.000Z","size":1237,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-28T06:52:46.527Z","etag":null,"topics":["bencode","encoder","encoder-decoder","encoding","library","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexpdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-11T01:21:02.000Z","updated_at":"2023-06-10T20:30:25.000Z","dependencies_parsed_at":"2024-10-27T17:17:32.908Z","dependency_job_id":"a26bd1cf-fc59-4ac0-82f1-d40203dc0584","html_url":"https://github.com/alexpdev/pyben","commit_stats":{"total_commits":65,"total_committers":2,"mean_commits":32.5,"dds":0.01538461538461533,"last_synced_commit":"3c7b10ea9b34fa6740878e3395bbabbad95712b4"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpdev%2Fpyben","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpdev%2Fpyben/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpdev%2Fpyben/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpdev%2Fpyben/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexpdev","download_url":"https://codeload.github.com/alexpdev/pyben/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243901523,"owners_count":20366252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bencode","encoder","encoder-decoder","encoding","library","python"],"created_at":"2024-10-08T20:04:34.111Z","updated_at":"2025-03-18T03:32:03.231Z","avatar_url":"https://github.com/alexpdev.png","language":"Python","readme":"# Pyben v0.3.3\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\u0026label=PyPi%20Downloads\u0026logo=PyPi\u0026logoColor=cyan\u0026style=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\u0026amp;utm_medium=referral\u0026amp;utm_content=alexpdev/pyben\u0026amp;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\u0026utm_medium=referral\u0026utm_content=alexpdev/pyben\u0026utm_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    \u003e\u003e\u003e import os\n    \u003e\u003e\u003e import pyben\n    \u003e\u003e\u003e file_path = \"path/to/encoded.file\"\n    \u003e\u003e\u003e data = {\"item1\": [\"item2\", 3, [4], {5: \"item6\"}]}\n    \u003e\u003e\u003e encoded = pyben.dumps(data)\n    \u003e\u003e\u003e encoded\n    ... b'd5:item1l5:item2i3eli4eedi5e5:item6eee'\n    \u003e\u003e\u003e decoded = pyben.loads(encoded)\n    \u003e\u003e\u003e decoded\n    ... {'item1': ['item2', 3, [4], {5: 'item6'}]}\n    \u003e\u003e\u003e 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    \u003e\u003e\u003e with open(file_path, \"wb\") as fd:\n    \u003e\u003e\u003e    pyben.dump(decoded, fd)\n    \u003e\u003e\u003e os.path.exists(file_path)\n    ... True\n    \u003e\u003e\u003e with open(file_path, \"rb\") as fd:\n    \u003e\u003e\u003e    decoded_file = pyben.load(fd)\n    \u003e\u003e\u003e decoded_file == decoded == data\n    ... True\n\nis the same as doing following.\n\n    \u003e\u003e\u003e pyben.dump(data, file_path)\n    \u003e\u003e\u003e os.path.exists(file_path)\n    ... True\n    \u003e\u003e\u003e decoded_file = pyben.load(file_path)\n    \u003e\u003e\u003e 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## Documentation\n\nGithub Pages: https://alexpdev.github.io/pyben\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpdev%2Fpyben","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexpdev%2Fpyben","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpdev%2Fpyben/lists"}