Part of twisted.mail.pop3client View Source View In Hierarchy
POP3 client protocol implementation class
Instances of this class provide a convenient, efficient API for retrieving and deleting messages from a POP3 server.Instance Variables | startedTLS | Whether TLS has been negotiated successfully.
(type: bool
) |
allowInsecureLogin | Indicate whether login() should be allowed if the server offers no
authentication challenge and if our transport does not offer any protection
via encryption.
(type: bool
) | |
serverChallenge | Challenge received from the server
(type: str or None
) | |
timeout | Number of seconds to wait before timing out a connection. If the number
is <= 0, no timeout checking will be performed.
(type: int
) |
Method | sendShort | Undocumented |
Method | sendLong | Undocumented |
Method | connectionMade | Called when a connection is made. |
Method | timeoutConnection | Called when the connection times out. |
Method | connectionLost | Called when the connection is shut down. |
Method | lineReceived | Override this for when each line is received. |
Method | lineLengthExceeded | Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way. |
Method | state_WELCOME | Undocumented |
Method | state_WAITING | Undocumented |
Method | state_SHORT | Undocumented |
Method | state_LONG_INITIAL | Undocumented |
Method | state_LONG | Undocumented |
Method | serverGreeting | Called when the server has sent us a greeting. |
Method | startTLS | Initiates a 'STLS' request and negotiates the TLS / SSL Handshake. |
Method | login | Log into the server. |
Method | apop | Perform APOP login. |
Method | user | Send the user command. |
Method | password | Send the password command. |
Method | delete | Delete a message from the server. |
Method | capabilities | Retrieve the capabilities supported by this server. |
Method | noop | Do nothing, with the help of the server. |
Method | reset | Remove the deleted flag from any messages which have it. |
Method | retrieve | Retrieve a message from the server. |
Method | stat | Get information about the size of this mailbox. |
Method | listSize | Retrieve a list of the size of all messages on the server. |
Method | listUID | Retrieve a list of the UIDs of all messages on the server. |
Method | quit | Disconnect from the server. |
Method | _blocked | Undocumented |
Method | _unblock | Undocumented |
Method | _startTLS | Undocumented |
Method | _startedTLS | Undocumented |
Method | _getContextFactory | Undocumented |
Method | _login | Undocumented |
Method | _loginTLS | Undocumented |
Method | _plaintext | Undocumented |
Method | _apop | Undocumented |
Method | _consumeOrSetItem | Undocumented |
Method | _consumeOrAppend | Undocumented |
Inherited from LineOnlyReceiver:
Method | dataReceived | Translates bytes into lines, and calls lineReceived. |
Method | sendLine | Sends a line to the other end of the connection. |
Inherited from BaseProtocol (via LineOnlyReceiver, Protocol):
Method | makeConnection | Make a connection to a transport and a server. |
Inherited from TimeoutMixin:
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 |
Called when a connection is made.
This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.Called when the connection times out.
Override to define behavior other than dropping the connection.Called when the connection is shut down.
Clear any circular references here, and any external references to this Protocol. The connection has been closed.Parameters | reason | (type: twisted.python.failure.Failure
) |
Parameters | line | The line which was received with the delimiter removed.
(type: str
) |
Parameters | greeting | The status message sent with the server greeting. For servers
implementing APOP authentication, this will be a challenge string. .
(type: str or None
) |
Parameters | contextFactory | (type: ssl.ClientContextFactory @param contextFactory: The context
factory with which to negotiate TLS. If None , try to create a
new one.
) |
Returns | A Deferred which fires when the transport has been secured according to the given contextFactory, or which fails if the transport cannot be secured. |
Log into the server.
If APOP is available it will be used. Otherwise, if TLS is available an 'STLS' session will be started and plaintext login will proceed. Otherwise, if the instance attribute allowInsecureLogin is set to True, insecure plaintext login will proceed. Otherwise, InsecureAuthenticationDisallowed will be raised (asynchronously).Parameters | username | The username with which to log in. |
password | The password with which to log in. | |
Returns | A deferred which fires when login has completed.
(type: Deferred
) |
Perform APOP 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, uselogin
instead.
Parameters | username | The username with which to log in. |
digest | The challenge response to authenticate with. |
Send the user command.
This performs the first half of plaintext login. Unless this is absolutely required, use thelogin
method instead.
Parameters | username | The username with which to log in. |
Send the password command.
This performs the second half of plaintext login. Unless this is absolutely required, use thelogin
method instead.
Parameters | password | The plaintext password with which to authenticate. |
Parameters | index | The index of the message to delete. This is 0-based.
(type: int
) |
Returns | A deferred which fires when the delete command is successful, or fails
if the server returns an error.
(type: Deferred
) |
Retrieve the capabilities supported by this 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).Parameters | useCache | If set, and if capabilities have been retrieved previously, just return
the previously retrieved results.
(type: bool
) |
Returns | A Deferred which fires with a dict mapping str
to None or list s of str . 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']} |
Do nothing, with the help of the server.
No operation is performed. The returned Deferred fires when the server responds.Remove the deleted flag from any messages which have it.
The returned Deferred fires when the server responds.Retrieve a message from the server.
Ifconsumer
is not None, it will be called with each line
of the message as it is received. Otherwise, the returned Deferred will be
fired with a list of all the lines when the message has been completely
received.
Get information about the size of this mailbox.
The returned Deferred will be fired with a tuple containing the number or messages in the mailbox and the size (in bytes) of the mailbox.Retrieve a list of the size of all messages on the server.
Ifconsumer
is not None, it will be called with two-tuples
of message index number and message size as they are received. Otherwise, a
Deferred which will fire with a list of only message sizes will be
returned. For messages which have been deleted, None will be used in place
of the message size.
Retrieve a list of the UIDs of all messages on the server.
Ifconsumer
is not None, it will be called with two-tuples
of message index number and message UID as they are received. Otherwise, a
Deferred which will fire with of list of only message UIDs will be
returned. For messages which have been deleted, None will be used in place
of the message UID.