class documentation

A parameterizable object that submits responses to specific patterns. Commonly used to implement password auto-responds for things like ``sudo``. .. versionadded:: 1.0

Method __init__ Imprint this `Responder` with necessary parameters.
Method pattern_matches Generic "search for pattern in stream, using index" behavior.
Method submit Act on ``stream`` data, potentially returning responses.
Instance Variable index Undocumented
Instance Variable pattern Undocumented
Instance Variable response Undocumented
def __init__(self, pattern, response): (source)

Imprint this `Responder` with necessary parameters. :param pattern: A raw string (e.g. ``r"\[sudo\] password for .*:"``) which will be turned into a regular expression. :param response: The string to submit to the subprocess' stdin when ``pattern`` is detected.

def pattern_matches(self, stream, pattern, index_attr): (source)

Generic "search for pattern in stream, using index" behavior. Used here and in some subclasses that want to track multiple patterns concurrently. :param str stream: The same data passed to ``submit``. :param str pattern: The pattern to search for. :param str index_attr: The name of the index attribute to use. :returns: An iterable of string matches. .. versionadded:: 1.0

def submit(self, stream): (source)

Act on ``stream`` data, potentially returning responses. :param str stream: All data read on this stream since the beginning of the session. :returns: An iterable of ``str`` (which may be empty). .. versionadded:: 1.0

Undocumented

Undocumented

response = (source)

Undocumented