A POP3 client protocol.

Instances of this class provide a convenient, efficient API for retrieving and deleting messages from a POP3 server.

This API provides a pipelining interface but POP3 pipelining on the network is not yet supported.

Instance Variable startedTLS An indication of whether TLS has been negotiated successfully. (type: bool)
Instance Variable allowInsecureLogin An indication of whether plaintext login should be allowed when the server offers no authentication challenge and the transport does not offer any protection via encryption. (type: bool)
Instance Variable serverChallenge The challenge received in the server greeting. (type: bytes or None)
Instance Variable timeout The number of seconds to wait on a response from the server before timing out a connection. If the number is <= 0, no timeout checking will be performed. (type: int)
Instance Variable state The state which indicates what type of response is expected from the server. Valid states are: 'WELCOME', 'WAITING', 'SHORT', 'LONG_INITIAL', 'LONG'. (type: bytes)
Method sendShort Send a POP3 command to which a short response is expected.
Method sendLong Send a POP3 command to which a multi-line response is expected.
Method connectionMade Wait for a greeting from the server after the connection has been made.
Method timeoutConnection Drop the connection when the server does not respond in time.
Method connectionLost Clean up when the connection has been lost.
Method lineReceived Pass a received line to a state machine function and transition to the next state.
Method lineLengthExceeded Drop the connection when a server response exceeds the maximum line length (LineOnlyReceiver.MAX_LENGTH).
Method state_WELCOME Handle server responses for the WELCOME state in which the server greeting is expected.
Method state_WAITING Log an error for server responses received in the WAITING state during which the server is not expected to send anything.
Method state_SHORT Handle server responses for the SHORT state in which the server is expected to send a single line response.
Method state_LONG_INITIAL Handle server responses for the LONG_INITIAL state in which the server is expected to send the first line of a multi-line response.
Method state_LONG Handle server responses for the LONG state in which the server is expected to send a non-initial line of a multi-line response.
Method serverGreeting Handle the server greeting.
Method startTLS Switch to encrypted communication using TLS.
Method login Log in to the server.
Method apop Send an APOP command to perform authenticated login.
Method user Send a USER command to perform the first half of plaintext login.
Method password Send a PASS command to perform the second half of plaintext login.
Method delete Send a DELE command to delete a message from the server.
Method capabilities Send a CAPA command to retrieve the capabilities supported by the server.
Method noop Send a NOOP command asking the server to do nothing but respond.
Method reset Send a RSET command to unmark any messages that have been flagged for deletion on the server.
Method retrieve Send a RETR or TOP command to retrieve all or part of a message from the server.
Method stat Send a STAT command to get information about the size of the mailbox.
Method listSize Send a LIST command to retrieve the sizes of all messages on the server.
Method listUID Send a UIDL command to retrieve the UIDs of all messages on the server.
Method quit Send a QUIT command to disconnect from the server.
Instance Variable _capCache The cached server capabilities. Capabilities are not allowed to change during the session (except when TLS is negotiated), so the first response to a capabilities command can be used for later lookups. (type: None or dict mapping bytes to list of bytes and/or bytes to None)
Instance Variable _challengeMagicRe A regular expression which matches the challenge in the server greeting. (type: RegexObject)
Instance Variable _blockedQueue A list of blocked commands. While a command is awaiting a response from the server, other commands are blocked. When no command is outstanding, _blockedQueue is set to None. Otherwise, it contains a list of information about blocked commands. Each list entry provides the following information about a blocked command: the deferred that should be called when the response to the command is received, the function that sends the command, and the arguments to the function. (type: None or list of 3-tuple of (0) Deferred, (1) callable which results in a Deferred, (2) tuple)
Instance Variable _waiting A deferred which fires when the response to the outstanding command is received from the server. (type: Deferred or None)
Instance Variable _timedOut An indication of whether the connection was dropped because of a timeout. (type: bool)
Instance Variable _greetingError The server greeting minus the status indicator, when the connection was dropped because of an error in the server greeting. Otherwise, None. (type: bytes or None)
Instance Variable _xform The transform function which is used to convert each line of a multi-line response into usable values for use by the consumer function. If None, each line of the multi-line response is sent directly to the consumer function. (type: None or callable that takes bytes and returns object)
Instance Variable _consumer The consumer function which is used to store the values derived by the transform function from each line of a multi-line response into a list. (type: callable that takes object)
Method _blocked Block a command, if necessary.
Method _unblock Send the next blocked command.
Method _startTLS Continue the process of switching to encrypted communication.
Method _startedTLS Complete the process of switching to encrypted communication.
Method _getContextFactory Get a context factory with which to negotiate TLS.
Method _login Continue the process of logging in to the server.
Method _loginTLS Do a plaintext login over an encrypted transport.
Method _plaintext Perform a plaintext login.
Method _apop Perform an APOP login.
Method _consumeOrSetItem Send a command to which a long response is expected and process the multi-line response into a list accounting for deleted messages.
Method _consumeOrAppend Send a command to which a long response is expected and process the multi-line response into a list.

Inherited from TimeoutMixin:

Class Variable timeOut The number of seconds after which to timeout the connection.
Method callLater Wrapper around reactor.callLater for test purpose.
Method resetTimeout Reset the timeout count down.
Method setTimeout Change the timeout period
Method __timedOut Undocumented

Inherited from TimeoutMixin:

Class Variable timeOut The number of seconds after which to timeout the connection.
Method callLater Wrapper around reactor.callLater for test purpose.
Method resetTimeout Reset the timeout count down.
Method setTimeout Change the timeout period
Method __timedOut Undocumented

Inherited from TimeoutMixin:

Class Variable timeOut The number of seconds after which to timeout the connection.
Method callLater Wrapper around reactor.callLater for test purpose.
Method resetTimeout Reset the timeout count down.
Method setTimeout Change the timeout period
Method __timedOut Undocumented

Inherited from TimeoutMixin:

Class Variable timeOut The number of seconds after which to timeout the connection.
Method callLater Wrapper around reactor.callLater for test purpose.
Method resetTimeout Reset the timeout count down.
Method setTimeout Change the timeout period
Method __timedOut Undocumented
startedTLS =
An indication of whether TLS has been negotiated successfully. (type: bool)
allowInsecureLogin =
An indication of whether plaintext login should be allowed when the server offers no authentication challenge and the transport does not offer any protection via encryption. (type: bool)
serverChallenge =
The challenge received in the server greeting. (type: bytes or None)
timeout =
The number of seconds to wait on a response from the server before timing out a connection. If the number is <= 0, no timeout checking will be performed. (type: int)
_capCache =
The cached server capabilities. Capabilities are not allowed to change during the session (except when TLS is negotiated), so the first response to a capabilities command can be used for later lookups. (type: None or dict mapping bytes to list of bytes and/or bytes to None)
_challengeMagicRe =
A regular expression which matches the challenge in the server greeting. (type: RegexObject)
_blockedQueue =
A list of blocked commands. While a command is awaiting a response from the server, other commands are blocked. When no command is outstanding, _blockedQueue is set to None. Otherwise, it contains a list of information about blocked commands. Each list entry provides the following information about a blocked command: the deferred that should be called when the response to the command is received, the function that sends the command, and the arguments to the function. (type: None or list of 3-tuple of (0) Deferred, (1) callable which results in a Deferred, (2) tuple)
_waiting =
A deferred which fires when the response to the outstanding command is received from the server. (type: Deferred or None)
_timedOut =
An indication of whether the connection was dropped because of a timeout. (type: bool)
_greetingError =
The server greeting minus the status indicator, when the connection was dropped because of an error in the server greeting. Otherwise, None. (type: bytes or None)
state =
The state which indicates what type of response is expected from the server. Valid states are: 'WELCOME', 'WAITING', 'SHORT', 'LONG_INITIAL', 'LONG'. (type: bytes)
_xform =
The transform function which is used to convert each line of a multi-line response into usable values for use by the consumer function. If None, each line of the multi-line response is sent directly to the consumer function. (type: None or callable that takes bytes and returns object)
_consumer =
The consumer function which is used to store the values derived by the transform function from each line of a multi-line response into a list. (type: callable that takes object)
def _blocked(self, f, *a): (source)

Block a command, if necessary.

If commands are being blocked, append information about the function which sends the command to a list and return a deferred that will be chained with the return value of the function when it eventually runs. Otherwise, set up for subsequent commands to be blocked and return None.

ParametersfA function which sends a command. (type: callable)
aArguments to the function. (type: tuple)
ReturnsNone if the command can run immediately. Otherwise, a deferred that will eventually trigger with the return value of the function. (type: None or Deferred)
def _unblock(self): (source)

Send the next blocked command.

If there are no more commands in the blocked queue, set up for the next command to be sent immediately.

def sendShort(self, cmd, args): (source)

Send a POP3 command to which a short response is expected.

Block all further commands from being sent until the response is received. Transition the state to SHORT.

ParameterscmdA POP3 command. (type: bytes)
argsThe command arguments. (type: bytes)
ReturnsA deferred which fires when the entire response is received. On an OK response, it returns the response from the server minus the status indicator. On an ERR response, it issues a server error response failure with the response from the server minus the status indicator. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def sendLong(self, cmd, args, consumer, xform): (source)

Send a POP3 command to which a multi-line response is expected.

Block all further commands from being sent until the entire response is received. Transition the state to LONG_INITIAL.

ParameterscmdA POP3 command. (type: bytes)
argsThe command arguments. (type: bytes)
consumerA consumer function which should be used to put the values derived by a transform function from each line of the multi-line response into a list. (type: callable that takes object)
xformA transform function which should be used to transform each line of the multi-line response into usable values for use by a consumer function. If None, each line of the multi-line response should be sent directly to the consumer function. (type: None or callable that takes bytes and returns object)
ReturnsA deferred which fires when the entire response is received. On an OK response, it returns the consumer function. On an ERR response, it issues a server error response failure with the response from the server minus the status indicator and the consumer function. (type: Deferred which successfully fires with callable that takes object and fails with ServerErrorResponse)
def connectionMade(self): (source)

Wait for a greeting from the server after the connection has been made.

Start the connection in the WELCOME state.

def timeoutConnection(self): (source)

Drop the connection when the server does not respond in time.

def connectionLost(self, reason): (source)

Clean up when the connection has been lost.

When the loss of connection was initiated by the client due to a timeout, the _timedOut flag will be set. When it was initiated by the client due to an error in the server greeting, _greetingError will be set to the server response minus the status indicator.

ParametersreasonThe reason the connection was terminated. (type: Failure)
def lineReceived(self, line): (source)

Pass a received line to a state machine function and transition to the next state.

ParameterslineA received line. (type: bytes)
def lineLengthExceeded(self, buffer): (source)

Drop the connection when a server response exceeds the maximum line length (LineOnlyReceiver.MAX_LENGTH).

ParametersbufferA received line which exceeds the maximum line length. (type: bytes)
def state_WELCOME(self, line): (source)

Handle server responses for the WELCOME state in which the server greeting is expected.

WELCOME is the first state. The server should send one line of text with a greeting and possibly an APOP challenge. Transition the state to WAITING.

ParameterslineA line received from the server. (type: bytes)
ReturnsThe next state. (type: bytes)
def state_WAITING(self, line): (source)

Log an error for server responses received in the WAITING state during which the server is not expected to send anything.

ParameterslineA line received from the server. (type: bytes)
def state_SHORT(self, line): (source)

Handle server responses for the SHORT state in which the server is expected to send a single line response.

Parse the response and fire the deferred which is waiting on receipt of a complete response. Transition the state back to WAITING.

ParameterslineA line received from the server. (type: bytes)
ReturnsThe next state. (type: bytes)
def state_LONG_INITIAL(self, line): (source)

Handle server responses for the LONG_INITIAL state in which the server is expected to send the first line of a multi-line response.

Parse the response. On an OK response, transition the state to LONG. On an ERR response, cleanup and transition the state to WAITING.

ParameterslineA line received from the server. (type: bytes)
ReturnsThe next state. (type: bytes)
def state_LONG(self, line): (source)

Handle server responses for the LONG state in which the server is expected to send a non-initial line of a multi-line response.

On receipt of the last line of the response, clean up, fire the deferred which is waiting on receipt of a complete response, and transition the state to WAITING. Otherwise, pass the line to the transform function, if provided, and then the consumer function.

ParameterslineA line received from the server. (type: bytes)
ReturnsThe next state. (type: bytes)
def serverGreeting(self, greeting): (source)

Handle the server greeting.

ParametersgreetingThe server greeting minus the status indicator. For servers implementing APOP authentication, this will contain a challenge string. (type: bytes)
def startTLS(self, contextFactory=None): (source)

Switch to encrypted communication using TLS.

The first step of switching to encrypted communication is obtaining the server's capabilities. When that is complete, the _startTLS callback function continues the switching process.

ParameterscontextFactoryThe context factory with which to negotiate TLS. If not provided, try to create a new one. (type: None or ClientContextFactory)
ReturnsA deferred which fires when the transport has been secured according to the given context factory with the server capabilities, or which fails with a TLS error if the transport cannot be secured. (type: Deferred which successfully results in dict mapping bytes to list of bytes and/or bytes to None or fails with TLSError)
def _startTLS(self, caps, contextFactory, tls): (source)

Continue the process of switching to encrypted communication.

This callback function runs after the server capabilities are received.

The next step is sending the server an STLS command to request a switch to encrypted communication. When an OK response is received, the _startedTLS callback function completes the switch to encrypted communication. Then, the new server capabilities are requested.

ParameterscapsThe server capabilities. (type: dict mapping bytes to list of bytes and/or bytes to None)
contextFactoryA context factory with which to negotiate TLS. (type: ClientContextFactory)
tlsA TCP transport that supports switching to TLS midstream. (type: ITLSTransport)
ReturnsA deferred which successfully fires when the response from the server to the request to start TLS has been received and the new server capabilities have been received or fails when the server does not support TLS. (type: Deferred which successfully triggers with dict mapping bytes to list of bytes and/or bytes to None or fails with TLSNotSupportedError)
def _startedTLS(self, result, context, tls): (source)

Complete the process of switching to encrypted communication.

This callback function runs after the response to the STLS command has been received.

The final steps are discarding the cached capabilities and initiating TLS negotiation on the transport.

ParametersresultThe server capabilities. (type: dict mapping bytes to list of bytes and/or bytes to None)
contextA context factory with which to negotiate TLS. (type: ClientContextFactory)
tlsA TCP transport that supports switching to TLS midstream. (type: ITLSTransport)
ReturnsThe server capabilities. (type: dict mapping bytes to list of bytes and/or bytes to None)
def _getContextFactory(self): (source)

Get a context factory with which to negotiate TLS.

ReturnsA context factory or None if TLS is not supported on the client. (type: None or ClientContextFactory)
def login(self, username, password): (source)

Log in to the server.

If APOP is available it will be used. Otherwise, if TLS is available, an encrypted session will be started and plaintext login will proceed. Otherwise, if allowInsecureLogin is set, insecure plaintext login will proceed. Otherwise, InsecureAuthenticationDisallowed will be raised.

The first step of logging into the server is obtaining the server's capabilities. When that is complete, the _login callback function continues the login process.

ParametersusernameThe username with which to log in. (type: bytes)
passwordThe password with which to log in. (type: bytes)
ReturnsA deferred which fires when the login process is complete. On a successful login, it returns the server's response minus the status indicator. (type: Deferred which successfully fires with bytes)
def _login(self, caps, username, password): (source)

Continue the process of logging in to the server.

This callback function runs after the server capabilities are received.

If the server provided a challenge in the greeting, proceed with an APOP login. Otherwise, if the server and the transport support encrypted communication, try to switch to TLS and then complete the login process with the _loginTLS callback function. Otherwise, if insecure authentication is allowed, do a plaintext login. Otherwise, fail with an InsecureAuthenticationDisallowed error.

ParameterscapsThe server capabilities. (type: dict mapping bytes to list of bytes and/or bytes to None)
usernameThe username with which to log in. (type: bytes)
passwordThe password with which to log in. (type: bytes)
ReturnsA deferred which fires when the login process is complete. On a successful login, it returns the server's response minus the status indicator. (type: Deferred which successfully fires with bytes)
def _loginTLS(self, res, username, password): (source)

Do a plaintext login over an encrypted transport.

This callback function runs after the transport switches to encrypted communication.

ParametersresThe server capabilities. (type: dict mapping bytes to list of bytes and/or bytes to None)
usernameThe username with which to log in. (type: bytes)
passwordThe password with which to log in. (type: bytes)
ReturnsA deferred which fires when the server accepts the username and password or fails when the server rejects either. On a successful login, it returns the server's response minus the status indicator. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def _plaintext(self, username, password): (source)

Perform a plaintext login.

ParametersusernameThe username with which to log in. (type: bytes)
passwordThe password with which to log in. (type: bytes)
ReturnsA deferred which fires when the server accepts the username and password or fails when the server rejects either. On a successful login, it returns the server's response minus the status indicator. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def _apop(self, username, password, challenge): (source)

Perform an APOP login.

ParametersusernameThe username with which to log in. (type: bytes)
passwordThe password with which to log in. (type: bytes)
challengeA challenge string. (type: bytes)
ReturnsA deferred which fires when the server response is received. On a successful login, it returns the server response minus the status indicator. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def apop(self, username, digest): (source)

Send an APOP command to perform authenticated login.

This should be used in special circumstances only, when it is known that the server supports APOP authentication, and APOP authentication is absolutely required. For the common case, use login instead.

ParametersusernameThe username with which to log in. (type: bytes)
digestThe challenge response to authenticate with. (type: bytes)
ReturnsA deferred which fires when the server response is received. On an OK response, the deferred succeeds with the server response minus the status indicator. On an ERR response, the deferred fails with a server error response failure. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def user(self, username): (source)

Send a USER command to perform the first half of plaintext login.

Unless this is absolutely required, use the login method instead.

ParametersusernameThe username with which to log in. (type: bytes)
ReturnsA deferred which fires when the server response is received. On an OK response, the deferred succeeds with the server response minus the status indicator. On an ERR response, the deferred fails with a server error response failure. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def password(self, password): (source)

Send a PASS command to perform the second half of plaintext login.

Unless this is absolutely required, use the login method instead.

ParameterspasswordThe plaintext password with which to authenticate. (type: bytes)
ReturnsA deferred which fires when the server response is received. On an OK response, the deferred succeeds with the server response minus the status indicator. On an ERR response, the deferred fails with a server error response failure. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def delete(self, index): (source)

Send a DELE command to delete a message from the server.

ParametersindexThe 0-based index of the message to delete. (type: int)
ReturnsA deferred which fires when the server response is received. On an OK response, the deferred succeeds with the server response minus the status indicator. On an ERR response, the deferred fails with a server error response failure. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def _consumeOrSetItem(self, cmd, args, consumer, xform): (source)

Send a command to which a long response is expected and process the multi-line response into a list accounting for deleted messages.

ParameterscmdA POP3 command to which a long response is expected. (type: bytes)
argsThe command arguments. (type: bytes)
consumerNone or a function that consumes the output from the transform function. (type: None or callable that takes object)
xformA function that parses a line from a multi-line response and transforms the values into usable form for input to the consumer function. If no consumer function is specified, the output must be a message index and corresponding value. If no transform function is specified, the line is used as is. (type: None, callable that takes bytes and returns 2-tuple of (0) int, (1) object, or callable that takes bytes and returns object)
ReturnsA deferred which fires when the entire response has been received. When a consumer is not provided, the return value is a list of the value for each message or None for deleted messages. Otherwise, it returns the consumer itself. (type: Deferred which fires with list of object or callable that takes list of object)
def _consumeOrAppend(self, cmd, args, consumer, xform): (source)

Send a command to which a long response is expected and process the multi-line response into a list.

ParameterscmdA POP3 command which expects a long response. (type: bytes)
argsThe command arguments. (type: bytes)
consumerNone or a function that consumes the output from the transform function. (type: None or callable that takes object)
xformA function that transforms a line from a multi-line response into usable form for input to the consumer function. If no transform function is specified, the line is used as is. (type: None or callable that takes bytes and returns object)
ReturnsA deferred which fires when the entire response has been received. When a consumer is not provided, the return value is a list of the transformed lines. Otherwise, it returns the consumer itself. (type: Deferred which fires with list of 2-tuple of (0) int, (1) object or callable that takes 2-tuple of (0) int, (1) object)
def capabilities(self, useCache=True): (source)

Send a CAPA command to retrieve the capabilities supported by the server.

Not all servers support this command. If the server does not support this, it is treated as though it returned a successful response listing no capabilities. At some future time, this may be changed to instead seek out information about a server's capabilities in some other fashion (only if it proves useful to do so, and only if there are servers still in use which do not support CAPA but which do support POP3 extensions that are useful).

ParametersuseCacheA flag that determines whether previously retrieved results should be used if available. (type: bool)
ReturnsA deferred which fires with a mapping of capability name to parameters. For example:
   C: CAPA
   S: +OK Capability list follows
   S: TOP
   S: USER
   S: SASL CRAM-MD5 KERBEROS_V4
   S: RESP-CODES
   S: LOGIN-DELAY 900
   S: PIPELINING
   S: EXPIRE 60
   S: UIDL
   S: IMPLEMENTATION Shlemazle-Plotz-v302
   S: .

will be lead to a result of:

   | {'TOP': None,
   |  'USER': None,
   |  'SASL': ['CRAM-MD5', 'KERBEROS_V4'],
   |  'RESP-CODES': None,
   |  'LOGIN-DELAY': ['900'],
   |  'PIPELINING': None,
   |  'EXPIRE': ['60'],
   |  'UIDL': None,
   |  'IMPLEMENTATION': ['Shlemazle-Plotz-v302']}
(type: Deferred which successfully results in dict mapping bytes to list of bytes and/or bytes to None)
def noop(self): (source)

Send a NOOP command asking the server to do nothing but respond.

ReturnsA deferred which fires when the server response is received. On an OK response, the deferred succeeds with the server response minus the status indicator. On an ERR response, the deferred fails with a server error response failure. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def reset(self): (source)

Send a RSET command to unmark any messages that have been flagged for deletion on the server.

ReturnsA deferred which fires when the server response is received. On an OK response, the deferred succeeds with the server response minus the status indicator. On an ERR response, the deferred fails with a server error response failure. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
def retrieve(self, index, consumer=None, lines=None): (source)

Send a RETR or TOP command to retrieve all or part of a message from the server.

ParametersindexA 0-based message index. (type: int)
consumerA function which consumes each transformed line from a multi-line response as it is received. (type: None or callable that takes bytes)
linesIf specified, the number of lines of the message to be retrieved. Otherwise, the entire message is retrieved. (type: None or int)
ReturnsA deferred which fires when the entire response has been received. When a consumer is not provided, the return value is a list of the transformed lines. Otherwise, it returns the consumer itself. (type: Deferred which fires with list of bytes, or callable that takes 2-tuple of (0) int, (1) object)
def stat(self): (source)

Send a STAT command to get information about the size of the mailbox.

ReturnsA deferred which fires when the server response is received. On an OK response, the deferred succeeds with the number of messages in the mailbox and the size of the mailbox in octets. On an ERR response, the deferred fails with a server error response failure. (type: Deferred which successfully fires with a 2-tuple of (0) int, (1) int or fails with ServerErrorResponse)
def listSize(self, consumer=None): (source)

Send a LIST command to retrieve the sizes of all messages on the server.

ParametersconsumerA function which consumes the 0-based message index and message size derived from the server response. (type: None or callable that takes 2-tuple of (0) int, (1) int)
ReturnsA deferred which fires when the entire response has been received. When a consumer is not provided, the return value is a list of message sizes. Otherwise, it returns the consumer itself. (type: Deferred which fires list of int or callable that takes 2-tuple of (0) int, (1) int)
def listUID(self, consumer=None): (source)

Send a UIDL command to retrieve the UIDs of all messages on the server.

ParametersconsumerA function which consumes the 0-based message index and UID derived from the server response. (type: None or callable that takes 2-tuple of (0) int, (1) bytes)
ReturnsA deferred which fires when the entire response has been received. When a consumer is not provided, the return value is a list of message sizes. Otherwise, it returns the consumer itself. (type: Deferred which fires with list of object or callable that takes 2-tuple of (0) int, (1) bytes)
def quit(self): (source)

Send a QUIT command to disconnect from the server.

ReturnsA deferred which fires when the server response is received. On an OK response, the deferred succeeds with the server response minus the status indicator. On an ERR response, the deferred fails with a server error response failure. (type: Deferred which successfully fires with bytes or fails with ServerErrorResponse)
API Documentation for Twisted, generated by pydoctor at 2017-06-11 10:59:01.