{"id":14222478,"url":"https://github.com/acatton/ohneio","last_synced_at":"2025-04-09T17:52:54.542Z","repository":{"id":57448447,"uuid":"66112261","full_name":"acatton/ohneio","owner":"acatton","description":"Parse protocols, without any I/O","archived":false,"fork":false,"pushed_at":"2017-10-20T23:51:49.000Z","size":39,"stargazers_count":47,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T19:51:33.237Z","etag":null,"topics":["asyncio","framework","parser","python-3"],"latest_commit_sha":null,"homepage":"http://ohneio.rtfd.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acatton.png","metadata":{"files":{"readme":"README","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}},"created_at":"2016-08-19T21:04:56.000Z","updated_at":"2025-01-20T01:41:08.000Z","dependencies_parsed_at":"2022-09-18T12:30:59.202Z","dependency_job_id":null,"html_url":"https://github.com/acatton/ohneio","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acatton%2Fohneio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acatton%2Fohneio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acatton%2Fohneio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acatton%2Fohneio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acatton","download_url":"https://codeload.github.com/acatton/ohneio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248083411,"owners_count":21045092,"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":["asyncio","framework","parser","python-3"],"created_at":"2024-08-19T19:01:41.491Z","updated_at":"2025-04-09T17:52:54.518Z","avatar_url":"https://github.com/acatton.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Ohne I/O\n========\n\n.. image:: https://travis-ci.org/acatton/ohneio.svg?branch=master\n    :target: https://travis-ci.org/acatton/ohneio\n\nUtility library to write network protocol parser, `sans I/O \u003chttps://sans-io.readthedocs.io/\u003e`_.\n\n`Ohne \u003chttps://en.wiktionary.org/wiki/ohne#German\u003e`_ I/O (without I/O in German) is a library using\n`asyncio \u003chttps://docs.python.org/3/library/asyncio.html\u003e`_ corouting programming style.\n\nThis library only supports Python 3.4+ (including Python 3.6 nightly)\n\n``ohneio`` allows you to write protocol parsers the way you would write an asyncio protocol:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import base64\n    \u003e\u003e\u003e import ohneio\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e def wait_for(s):\n    ...     while True:\n    ...         data = yield from ohneio.peek()\n    ...         pos = data.find(s)\n    ...         if pos \u003e= 0:\n    ...             return pos\n    ...         yield from ohneio.wait()\n    ...\n    \u003e\u003e\u003e def read_until(s):\n    ...     pos = yield from wait_for(s)\n    ...     data = yield from ohneio.read(pos)\n    ...     return data\n    ...\n    \u003e\u003e\u003e @ohneio.protocol\n    ... def echo_base64(separator):\n    ...     while True:\n    ...         segment = yield from read_until(separator)\n    ...         yield from ohneio.read(len(separator))\n    ...         yield from ohneio.write(base64.b64encode(segment) + separator)\n    ...\n    \u003e\u003e\u003e connection = echo_base64(b'\\r\\n')\n    \u003e\u003e\u003e connection.send(b'hello')\n    \u003e\u003e\u003e connection.read()\n    b''\n    \u003e\u003e\u003e connection.send(b'\\r\\nworld\\r\\n')\n    \u003e\u003e\u003e connection.read()\n    b'aGVsbG8=\\r\\nd29ybGQ=\\r\\n'\n\n\nThe example above also shows how ``ohneio`` allows you to combine primitives\ninto bigger parsing functions (like ``wait_for`` and ``read_until``).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facatton%2Fohneio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facatton%2Fohneio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facatton%2Fohneio/lists"}