Ohne I/O
Utility library to write network protocol parser, sans I/O.
Ohne I/O (without I/O in German) is a library using asyncio corouting programming style.
ohneio allows you to write protocol parsers the way you would write an asyncio protocol:
>>> import base64
>>> import ohneio
>>>
>>> def wait_for(s):
... while True:
... data = yield from ohneio.peek()
... pos = data.find(s)
... if pos >= 0:
... return pos
... yield from ohneio.wait()
...
>>> def read_until(s):
... pos = yield from wait_for(s)
... data = yield from ohneio.read(pos)
... return data
...
>>> @ohneio.protocol
... def echo_base64(separator):
... while True:
... segment = yield from read_until(separator)
... yield from ohneio.read(len(separator))
... yield from ohneio.write(base64.b64encode(segment) + separator)
...
>>> connection = echo_base64(b'\r\n')
>>> connection.send(b'hello')
>>> connection.read()
b''
>>> connection.send(b'\r\nworld\r\n')
>>> connection.read()
b'aGVsbG8=\r\nd29ybGQ=\r\n'
The example above also shows how ohneio allows you to combine primitives into bigger parsing functions (like wait_for and read_until).
Metadata
Release files for ohneio 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ohneio-0.8.1.tar.gz | 3.5 kB | Without provenance | Details for ohneio-0.8.1.tar.gz |
Release files / ohneio-0.8.1.tar.gz
| Download URL | ohneio-0.8.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d09754ddc90a7785e1c3457b7b8a5654badd7e1611dc0f42ee5a70ca5b4fdc7
|
|
BLAKE2b-256 checksum How to use checksums |
784fbf2d82f575ac8122e86d55c2a78afa23e442f56d15e78b3edb6134732390
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for ohneio 0.8.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.