Transport API¶
Transports are used for direct communication with the Riemann server. They
are usually used inside a Client
, and are used to send and receive
protocol buffer objects.
-
riemann_client.transport.
socket_recvall
(socket, length, bufsize=4096)[source]¶ A helper method to read of bytes from a socket to a maximum length
-
exception
riemann_client.transport.
RiemannError
[source]¶ Bases:
exceptions.Exception
Raised when the Riemann server returns an error message
-
class
riemann_client.transport.
Transport
[source]¶ Bases:
object
Abstract transport definition
Subclasses must implement the
connect()
,disconnect()
andsend()
methods.Can be used as a context manager, which will call
connect()
on entry anddisconnect()
on exit.
-
class
riemann_client.transport.
SocketTransport
(host='localhost', port=5555)[source]¶ Bases:
riemann_client.transport.Transport
Provides common methods for Transports that use a sockets
-
address
¶ Returns: A tuple describing the address to connect to Return type: (host, port)
-
socket
¶ Returns the socket after checking it has been created
-
-
class
riemann_client.transport.
TCPTransport
(host='localhost', port=5555, timeout=None)[source]¶ Bases:
riemann_client.transport.SocketTransport
Communicates with Riemann over TCP
Parameters: - host (str) – The hostname to connect to
- port (int) – The port to connect to
- timeout (int) – The time in seconds to wait before raising an error
-
class
riemann_client.transport.
TLSTransport
(host='localhost', port=5555, timeout=None, ca_certs=None)[source]¶ Bases:
riemann_client.transport.TCPTransport
Communicates with Riemann over TCP + TLS
Options are the same as
TCPTransport
unless notedParameters: ca_certs (str) – Path to a CA Cert bundle used to create the socket -
connect
()[source]¶ Connects using
TLSTransport.connect()
and wraps with TLS
-
-
class
riemann_client.transport.
BlankTransport
(*args, **kwargs)[source]¶ Bases:
riemann_client.transport.Transport
A transport that collects events in a list, and has no connection
Used by
--transport none
, which is useful for testing commands without contacting a Riemann server. This is also used by the automated tests inriemann_client/tests/test_riemann_command.py
.