py_fort_hermes.network¶
This modules provides a Context to read from a live leto instance
Example
import py_fort_hermes as fh
with fh.network.connect("host") as c:
for ro in c:
# do something with c
- class py_fort_hermes.network.Context(host, port=4002, blocking=True, timeout=2.0, allocateNewMessages=False)¶
A context manager to open network connection to a live leto
- py_fort_hermes.network.connect(host, port=4002, blocking=True, timeout=2.0, allocateNewMessages=False)¶
Connects to a leto host.
- Parameters
host (str) – the host to connect to
port (int) – the port to connect to
blocking (bool) – use a blocking connection
timeout (float) – sets a timeout for IO
allocateNewMessages (bool) – if True, each call to next() will return a newly allocated FrameReadout, with some performance onverhead. Otherwise the same object will be reused to avoid memory allocation.
- Returns
an iterable context manager for the connection
- Return type
- Raises
Exception – If the connection could not be established
InternalError – If the stream does not contain a valid header