autobahn.twisted.util


Module Contents

Functions

sleep(delay[, reactor])

Inline sleep for use in co-routines (Twisted inlineCallback decorated functions).

peer2str(→ str)

Return a peer descriptor given a Twisted transport, for example:

transport_channel_id(→ Optional[bytes])

extract_peer_certificate(→ Optional[Dict[str, Any]])

Dummy when no TLS is available.

create_transport_details(...)

Create transport details from Twisted transport.

Attributes

PipeAddress

_HAS_IPV6

_HAS_TLS

__all

autobahn.twisted.util.PipeAddress[source]
autobahn.twisted.util._HAS_IPV6 = True
autobahn.twisted.util._HAS_TLS = True
autobahn.twisted.util.__all = ['sleep', 'peer2str', 'transport_channel_id', 'extract_peer_certificate', 'create_transport_details']
autobahn.twisted.util.sleep(delay, reactor=None)[source]

Inline sleep for use in co-routines (Twisted inlineCallback decorated functions).

Parameters
  • delay (float) – Time to sleep in seconds.

  • reactor (None or provider of IReactorTime.) – The Twisted reactor to use.

autobahn.twisted.util.peer2str(transport: Union[twisted.internet.interfaces.ITransport, twisted.internet.interfaces.IProcessTransport]) str[source]

Return a peer descriptor given a Twisted transport, for example:

  • tcp4:127.0.0.1:52914: a TCPv4 socket

  • unix:/tmp/server.sock: a Unix domain socket

  • process:142092: a Pipe originating from a spawning (parent) process

  • pipe: a Pipe terminating in a spawned (child) process

Returns

Returns a string representation of the peer of the Twisted transport.

autobahn.twisted.util.transport_channel_id(transport: object, is_server: bool, channel_id_type: Optional[str] = None) Optional[bytes][source]
autobahn.twisted.util.extract_peer_certificate(transport: object) Optional[Dict[str, Any]][source]

Dummy when no TLS is available.

Parameters

transport – Ignored.

Returns

Always return None.

autobahn.twisted.util.create_transport_details(transport: Union[twisted.internet.interfaces.ITransport, twisted.internet.interfaces.IProcessTransport], is_server: bool) autobahn.wamp.types.TransportDetails[source]

Create transport details from Twisted transport.

Parameters
  • transport – The Twisted transport to extract information from.

  • is_server – Flag indicating whether this transport side is a “server” (as in TCP server).

Returns

Transport details object filled with information from the Twisted transport.