Connection

Manages the details of the websocket connection.

run_until_complete(coro: Callable[[iterm2.connection.Connection], Coroutine[Any, Any, None]], retry=False, debug=False)None

Convenience method to run an async function taking an Connection as an argument.

After coro returns this function will return.

Parameters
  • coro – The coroutine to run. Must be an async def function. It should take one argument, a Connection, and does not need to return a value.

  • retry (bool) – Keep trying to connect until it succeeds?

run_forever(coro: Callable[[iterm2.connection.Connection], Coroutine[Any, Any, None]], retry=False, debug=False)None

Convenience method to run an async function taking an Connection as an argument.

This function never returns.

Parameters
  • coro – The coroutine to run. Must be an async def function. It should take one argument, a Connection, and does not need to return a value.

  • retry (bool) – Keep trying to connect until it succeeds?

class Connection

Represents a loopback network connection from the script to iTerm2.

Provides functionality for sending and receiving messages. Supports dispatching incoming messages.

async static async_create()iterm2.connection.Connection

Creates a new connection.

This is intended for use in an apython REPL. It constructs a new connection and returns it without creating an asyncio event loop.

Returns

A new connection to iTerm2.

See also

Running in a REPL


Indices and tables